comparison idavoll/backend.py @ 168:e2c2c2baf483

Fix use of uuid module now shipping with Python 2.5.
author Ralph Meijer <ralphm@ik.nu>
date Wed, 03 Oct 2007 19:07:50 +0000
parents ef22e4150caa
children 96afb248df5e
comparison
equal deleted inserted replaced
167:ef22e4150caa 168:e2c2c2baf483
106 raise error.ItemRequired() 106 raise error.ItemRequired()
107 107
108 if persist_items or deliver_payloads: 108 if persist_items or deliver_payloads:
109 for item in items: 109 for item in items:
110 if not item.getAttribute("id"): 110 if not item.getAttribute("id"):
111 item["id"] = uuid.generate() 111 item["id"] = str(uuid.uuid4())
112 112
113 if persist_items: 113 if persist_items:
114 d = node.store_items(items, requestor) 114 d = node.store_items(items, requestor)
115 else: 115 else:
116 d = defer.succeed(None) 116 d = defer.succeed(None)
184 def supports_instant_nodes(self): 184 def supports_instant_nodes(self):
185 return True 185 return True
186 186
187 def create_node(self, node_id, requestor): 187 def create_node(self, node_id, requestor):
188 if not node_id: 188 if not node_id:
189 node_id = 'generic/%s' % uuid.generate() 189 node_id = 'generic/%s' % uuid.uuid4()
190 d = self.storage.create_node(node_id, requestor) 190 d = self.storage.create_node(node_id, requestor)
191 d.addCallback(lambda _: node_id) 191 d.addCallback(lambda _: node_id)
192 return d 192 return d
193 193
194 def get_default_configuration(self): 194 def get_default_configuration(self):