[Server-devel] [PATCH] Add growdatastore script from Tomeu

martin.langhoff at gmail.com martin.langhoff at gmail.com
Mon Jun 16 13:46:27 EDT 2008


From: Martin Langhoff <martin at laptop.org>

---
 utils/growdatastore.py |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 utils/growdatastore.py

diff --git a/utils/growdatastore.py b/utils/growdatastore.py
new file mode 100644
index 0000000..4560a7b
--- /dev/null
+++ b/utils/growdatastore.py
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+## Authors: Tomeu Vizoso <tomeu at tomeuvizoso.net>
+##          Martin Langhoff <martin at laptop.org>
+
+import sys
+import os
+import unittest
+import time
+import tempfile
+import shutil
+from datetime import datetime
+
+import dbus
+
+DS_DBUS_SERVICE = "org.laptop.sugar.DataStore"
+DS_DBUS_INTERFACE = "org.laptop.sugar.DataStore"
+DS_DBUS_PATH = "/org/laptop/sugar/DataStore"
+
+bus = dbus.SessionBus()
+proxy = bus.get_object(DS_DBUS_SERVICE, DS_DBUS_PATH)
+data_store = dbus.Interface(proxy, DS_DBUS_INTERFACE)
+
+for i in range(0, 10):
+   resultset, count = data_store.find({}, ['uid'])
+   print count
+   for doc in resultset:
+       newdoc = data_store.get_properties(result['uid'])
+       # TODO: Give it a new name, make a copy 
+       # of the actual files related to this doc.
+       data_store.create(newdoc, '', True)
-- 
1.5.4.34.g053d9



More information about the Server-devel mailing list