Revision 26837206 snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py
b/snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py | ||
---|---|---|
206 | 206 |
|
207 | 207 |
s = self.nodes.select().where(and_(self.nodes.c.node == ROOTNODE, |
208 | 208 |
self.nodes.c.parent == ROOTNODE)) |
209 |
rp = self.conn.execute(s) |
|
210 |
r = rp.fetchone() |
|
211 |
rp.close() |
|
212 |
if not r: |
|
213 |
s = self.nodes.insert( |
|
214 |
).values(node=ROOTNODE, parent=ROOTNODE, path='') |
|
215 |
self.conn.execute(s) |
|
209 |
wrapper = self.wrapper |
|
210 |
wrapper.execute() |
|
211 |
try: |
|
212 |
rp = self.conn.execute(s) |
|
213 |
r = rp.fetchone() |
|
214 |
rp.close() |
|
215 |
if not r: |
|
216 |
s = self.nodes.insert( |
|
217 |
).values(node=ROOTNODE, parent=ROOTNODE, path='') |
|
218 |
self.conn.execute(s) |
|
219 |
finally: |
|
220 |
wrapper.commit() |
|
216 | 221 |
|
217 | 222 |
def node_create(self, parent, path): |
218 | 223 |
"""Create a new node from the given properties. |
Also available in: Unified diff