Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
245e39dd
authored
Aug 28, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common: add OperatedMixin.get_operation_class
parent
abfd7a2b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
circle/common/operations.py
+6
-3
No files found.
circle/common/operations.py
View file @
245e39dd
...
@@ -199,14 +199,17 @@ class OperatedMixin(object):
...
@@ -199,14 +199,17 @@ class OperatedMixin(object):
def
__getattr__
(
self
,
name
):
def
__getattr__
(
self
,
name
):
# NOTE: __getattr__ is only called if the attribute doesn't already
# NOTE: __getattr__ is only called if the attribute doesn't already
# exist in your __dict__
# exist in your __dict__
cls
=
self
.
__class__
return
self
.
get_operation_class
(
name
)(
self
)
@classmethod
def
get_operation_class
(
cls
,
name
):
ops
=
getattr
(
cls
,
operation_registry_name
,
{})
ops
=
getattr
(
cls
,
operation_registry_name
,
{})
op
=
ops
.
get
(
name
)
op
=
ops
.
get
(
name
)
if
op
:
if
op
:
return
op
(
self
)
return
op
else
:
else
:
raise
AttributeError
(
"
%
r object has no attribute
%
r"
%
raise
AttributeError
(
"
%
r object has no attribute
%
r"
%
(
self
.
__class__
.
__name__
,
name
))
(
cls
.
__name__
,
name
))
def
get_available_operations
(
self
,
user
):
def
get_available_operations
(
self
,
user
):
"""Yield Operations that match permissions of user and preconditions.
"""Yield Operations that match permissions of user and preconditions.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment