| OLD | NEW |
| 1 # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ |
| 2 # | 2 # |
| 3 # Permission is hereby granted, free of charge, to any person obtaining a | 3 # Permission is hereby granted, free of charge, to any person obtaining a |
| 4 # copy of this software and associated documentation files (the | 4 # copy of this software and associated documentation files (the |
| 5 # "Software"), to deal in the Software without restriction, including | 5 # "Software"), to deal in the Software without restriction, including |
| 6 # without limitation the rights to use, copy, modify, merge, publish, dis- | 6 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 7 # tribute, sublicense, and/or sell copies of the Software, and to permit | 7 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 8 # persons to whom the Software is furnished to do so, subject to the fol- | 8 # persons to whom the Software is furnished to do so, subject to the fol- |
| 9 # lowing conditions: | 9 # lowing conditions: |
| 10 # | 10 # |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 """Load this domain based on an XML document""" | 269 """Load this domain based on an XML document""" |
| 270 import xml.sax | 270 import xml.sax |
| 271 handler = DomainDumpParser(self) | 271 handler = DomainDumpParser(self) |
| 272 xml.sax.parse(doc, handler) | 272 xml.sax.parse(doc, handler) |
| 273 return handler | 273 return handler |
| 274 | 274 |
| 275 def delete(self): | 275 def delete(self): |
| 276 """ | 276 """ |
| 277 Delete this domain, and all items under it | 277 Delete this domain, and all items under it |
| 278 """ | 278 """ |
| 279 return self.connection.delete(self) | 279 return self.connection.delete_domain(self) |
| 280 | 280 |
| 281 | 281 |
| 282 class DomainMetaData: | 282 class DomainMetaData: |
| 283 | 283 |
| 284 def __init__(self, domain=None): | 284 def __init__(self, domain=None): |
| 285 self.domain = domain | 285 self.domain = domain |
| 286 self.item_count = None | 286 self.item_count = None |
| 287 self.item_names_size = None | 287 self.item_names_size = None |
| 288 self.attr_name_count = None | 288 self.attr_name_count = None |
| 289 self.attr_names_size = None | 289 self.attr_names_size = None |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 368 |
| 369 def run(self): | 369 def run(self): |
| 370 try: | 370 try: |
| 371 self.db.batch_put_attributes(self.items) | 371 self.db.batch_put_attributes(self.items) |
| 372 except: | 372 except: |
| 373 print "Exception using batch put, trying regular put instead" | 373 print "Exception using batch put, trying regular put instead" |
| 374 for item_name in self.items: | 374 for item_name in self.items: |
| 375 self.db.put_attributes(item_name, self.items[item_name]) | 375 self.db.put_attributes(item_name, self.items[item_name]) |
| 376 print ".", | 376 print ".", |
| 377 sys.stdout.flush() | 377 sys.stdout.flush() |
| OLD | NEW |