Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3d50c288
authored
Mar 23, 2014
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common: context manager for activities
parent
5adcd0d9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
circle/common/models.py
+4
-0
No files found.
circle/common/models.py
View file @
3d50c288
from
collections
import
deque
from
collections
import
deque
from
contextlib
import
contextmanager
from
hashlib
import
sha224
from
hashlib
import
sha224
from
logging
import
getLogger
from
logging
import
getLogger
from
time
import
time
from
time
import
time
...
@@ -32,6 +33,9 @@ def activitycontextimpl(act, on_abort=None, on_commit=None):
...
@@ -32,6 +33,9 @@ def activitycontextimpl(act, on_abort=None, on_commit=None):
act
.
finish
(
succeeded
=
True
,
event_handler
=
on_commit
)
act
.
finish
(
succeeded
=
True
,
event_handler
=
on_commit
)
activity_context
=
contextmanager
(
activitycontextimpl
)
class
ActivityModel
(
TimeStampedModel
):
class
ActivityModel
(
TimeStampedModel
):
activity_code
=
CharField
(
max_length
=
100
,
verbose_name
=
_
(
'activity code'
))
activity_code
=
CharField
(
max_length
=
100
,
verbose_name
=
_
(
'activity code'
))
parent
=
ForeignKey
(
'self'
,
blank
=
True
,
null
=
True
,
related_name
=
'children'
)
parent
=
ForeignKey
(
'self'
,
blank
=
True
,
null
=
True
,
related_name
=
'children'
)
...
...
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