diff options
author | Benjamin Saller <bcsaller@objectrealms.net> | 2007-05-10 02:30:56 (GMT) |
---|---|---|
committer | Benjamin Saller <bcsaller@objectrealms.net> | 2007-05-10 02:30:56 (GMT) |
commit | bdf0e842d2d8f9e6181ce2b8413637eb0629b252 (patch) | |
tree | ff3a8b4bfc58c7d40d79df924c53450c1a80f1cb /bin | |
parent | 0204d6f116382a2b19bc8376fe2682365df2eb9c (diff) |
fixed signal problem
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/datastore | 14 | ||||
-rwxr-xr-x | bin/sample-client.py | 13 |
2 files changed, 20 insertions, 7 deletions
diff --git a/bin/datastore b/bin/datastore index 1282a01..0131f75 100755 --- a/bin/datastore +++ b/bin/datastore @@ -1,15 +1,25 @@ #!/usr/bin/python2.4 from ore.main import Application from olpc.datastore import DataStore +import os + +base_dir = os.path.expanduser("~/.sugar/default") +repo_dir = os.path.join(base_dir, 'datastore') +db_dir = "sqlite:///%s/datastore.db" % repo_dir + +# operate from the repo directory +if not os.path.exists(repo_dir): + os.makedirs(repo_dir) +os.chdir(repo_dir) class DataStoreApplication(Application): def manage_options(self): self.parser.add_option("--olpc.repo", dest="repo_dir", - action="store", default="/tmp", + action="store", default=repo_dir, help="""Location of the Repository""") self.parser.add_option("--olpc.metadata", dest="md_db", - action="store", default="sqlite://", + action="store", default=db_dir, help="""Location of the Repository""") def main(self): diff --git a/bin/sample-client.py b/bin/sample-client.py index be45320..b32ac89 100755 --- a/bin/sample-client.py +++ b/bin/sample-client.py @@ -4,15 +4,18 @@ import dbus def main(): bus = dbus.SessionBus() - remote_object = bus.get_object("org.laptop.sugar.DataStore", + datastore = bus.get_object("org.laptop.sugar.DataStore", "/org/laptop/sugar/DataStore") - uid = remote_object.create(dict(title="from dbus"), '/etc/passwd') + uid = datastore.create(dict(title="from dbus"), '/etc/passwd') print "created uid", uid - print "all", remote_object.all() - print "bcsaller", remote_object.find(dict(fulltext="bcsaller")) - print "huh?", remote_object.find(dict(fulltext="kfdshaksjd")) + print "all", datastore.all() + print "bcsaller", datastore.find(dict(fulltext="bcsaller")) + print "huh?", datastore.find(dict(fulltext="kfdshaksjd")) + + datastore.update(uid, dict(title="updated title"), "/etc/passwd") + datastore.delete(uid) if __name__ == '__main__': main() |