1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# begin the database transaction.
request.tm.begin()

# get all Uri objects.
uris = m.uri.get_all_uris(request.dbsession)

# interate over all Uri objects.
for uri in uris:

    if uri.node:
        # modify the Uri's related Node.
        uri.node.has_uri = True
        # add the related Node object to the sqlalchemy session.
        request.dbsession.add(uri.node)

# flush / commit all changes stored the the sqlachemy session.
request.dbsession.flush()

# commit/close the database transaction to really make changes.
request.tm.commit()