Skip to content

Commit

Permalink
db module
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcouffin committed Oct 22, 2023
1 parent 465a013 commit 32f5fd5
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions pyrevitlib/pyrevit/revit/db/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ class Transaction():
before and after the context.
Automatically rolls back if exception is raised.
>>> with Transaction('Move Wall'):
>>> wall.DoSomething()
>>> with Transaction('Move Wall') as action:
>>> wall.DoSomething()
>>> assert action.status == ActionStatus.Started # True
>>> assert action.status == ActionStatus.Committed # True
'''python
with Transaction('Move Wall'):
wall.DoSomething()
with Transaction('Move Wall') as action:
wall.DoSomething()
assert action.status == ActionStatus.Started # True
assert action.status == ActionStatus.Committed # True
'''
"""
def __init__(self, name=None,
doc=None,
Expand Down Expand Up @@ -165,11 +167,14 @@ def carryout(name, doc=None):
name (str): Name of the Transaction
doc (Document): Revit document
>>> @doc.carryout('Do Something')
>>> def set_some_parameter(wall, value):
>>> wall.parameters['Comments'].value = value
>>>
>>> set_some_parameter(wall, value)
'''python
@doc.carryout('Do Something')
def set_some_parameter(wall, value):
wall.parameters['Comments'].value = value
set_some_parameter(wall, value)
'''
"""
from functools import wraps

Expand Down

0 comments on commit 32f5fd5

Please sign in to comment.