Skip to content

Commit

Permalink
Update transaction.py
Browse files Browse the repository at this point in the history
  • Loading branch information
marcantondahmen committed Oct 15, 2020
1 parent ed0c001 commit 63c2090
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions revitron/transaction.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
The ``transaction`` submodule contains a wrapper class to simplify the usage of transactions::
The ``transaction`` submodule contains a wrapper class to simplify the usage of transactions and subtransactions::
t = revitron.Transaction()
...
Expand All @@ -16,10 +16,15 @@ class Transaction:

def __init__(self):
"""
Inits a new transaction.
Inits a new transaction.
In case there is already an open transaction, a subtransaction will be initialized instead.
"""
import revitron
self.transaction = revitron.DB.Transaction(revitron.DOC, script.get_button().get_title())
if revitron.DOC.IsModifiable:
self.transaction = revitron.DB.SubTransaction(revitron.DOC)
else:
self.transaction = revitron.DB.Transaction(revitron.DOC, script.get_button().get_title())
self.transaction.Start()


Expand Down

0 comments on commit 63c2090

Please sign in to comment.