Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
satella
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
satella
Commits
8a02a625
Commit
8a02a625
authored
3 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
Got rid of decorator for transaction
parent
6d505ef2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+2
-0
2 additions, 0 deletions
CHANGELOG.md
satella/__init__.py
+1
-1
1 addition, 1 deletion
satella/__init__.py
satella/db.py
+0
-20
0 additions, 20 deletions
satella/db.py
with
3 additions
and
21 deletions
CHANGELOG.md
+
2
−
0
View file @
8a02a625
# v2.20.4
*
removed the decorator syntax for transaction, it's confusing and contrary to Zen of Python
\ No newline at end of file
This diff is collapsed.
Click to expand it.
satella/__init__.py
+
1
−
1
View file @
8a02a625
__version__
=
'
2.20.4a
1
'
__version__
=
'
2.20.4a
2
'
This diff is collapsed.
Click to expand it.
satella/db.py
+
0
−
20
View file @
8a02a625
...
...
@@ -19,13 +19,6 @@ class transaction:
Leaving the context manager will automatically close the cursor for you.
>>>
def
conn_getter_function
()
->
connection
:
>>>
.
...
>>>
@transaction
(
conn_getter_function
)
>>>
.
...
The same syntax can be used, if you session depends eg. on a thread.
:param connection_or_getter: the connection object to use, or a callable/0, that called with
this thread will provide us with a connection
:param close_the_connection_after: whether the connection should be closed after use
...
...
@@ -38,19 +31,6 @@ class transaction:
self
.
cursor
=
None
self
.
log_exception
=
log_exception
def
__call__
(
self
,
fun
):
@wraps
(
fun
)
def
inner
(
*
args
,
**
kwargs
):
with
self
as
cur
:
if
fun
.
__name__
==
fun
.
__qualname__
:
return
fun
(
cur
,
*
args
,
**
kwargs
)
else
:
if
not
len
(
args
):
return
fun
(
*
args
)
else
:
return
fun
(
*
args
[
0
],
cur
,
*
args
[
1
:],
**
kwargs
)
return
inner
def
__enter__
(
self
):
self
.
cursor
=
self
.
connection
.
cursor
()
return
self
.
cursor
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment