Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-06-26 13:06:03 (GMT)
committer Tomeu Vizoso <tomeu@sugarlabs.org>2009-06-26 13:06:03 (GMT)
commit3d7ef389ab8b4d06b68959ea07a7cdace350ad26 (patch)
treec56ca108ce4edb31a4f6067ce145496be83968b5
parentb569ce0d8f1e587e91b9b058ee3e6a087bf9cbd2 (diff)
parent6b679e122c2a45e29b61287eef3c083822535f49 (diff)
Merge branch 'master' of gitorious@git.sugarlabs.org:sugar-datastore/mainline
-rwxr-xr-xbin/copy-from-journal24
1 files changed, 10 insertions, 14 deletions
diff --git a/bin/copy-from-journal b/bin/copy-from-journal
index 9be49d4..457e9ff 100755
--- a/bin/copy-from-journal
+++ b/bin/copy-from-journal
@@ -21,23 +21,20 @@ RETURN_LIMIT = 2
def build_option_parser():
- usage = "Usage: %prog [-o OBJECT_ID] [-q SEARCH_STR] [-t SEARCH_STR] [-m] OUTFILE"
+ usage = "Usage: %prog [-o OBJECT_ID] [-q SEARCH_STR] [-m] OUTFILE"
parser = optparse.OptionParser(usage=usage)
parser.add_option("-o", "--object_id", action="store", dest="object_id",
- help="Retrieve object with explicit ID OBJECT_ID", metavar="OBJECT_ID",
- default=None)
+ help="Retrieve object with explicit ID OBJECT_ID",
+ metavar="OBJECT_ID", default=None)
parser.add_option("-q", "--query", action="store", dest="query",
- help="Full-text-search the metadata for SEARCH_STR", metavar="SEARCH_STR",
- default=None)
-
- parser.add_option("-t", "--title", action="store", dest="title",
- help="Full-text-search the title for SEARCH_STR", metavar="SEARCH_STR",
- default=None)
+ help="Full-text-search the metadata for SEARCH_STR",
+ metavar="SEARCH_STR", default=None)
parser.add_option("-m", "--metadata", action="store_true", dest="show_meta",
- help="Show all non-preview metadata [default: hide]", default=False)
+ help="Show all non-preview metadata [default: hide]",
+ default=False)
return parser
@@ -61,8 +58,6 @@ if __name__ == "__main__":
if options.query is not None:
query['query'] = options.query
- if options.title is not None:
- query['title'] = options.title
# We only want a single file at a time; limit the number of objects
# returned to two, as anything more than one means the criteria were
@@ -106,11 +101,12 @@ if __name__ == "__main__":
outext = sugar.mime.get_primary_extension(mimetype)
if outext == None:
outext = "dsobject"
+ outext = '.' + outext
# Lastly, actually copy the file out of the datastore and onto the
# filesystem.
- shutil.copyfile(dsentry.get_file_path(), outroot + '.' + outext)
- print '%s -> %s' % (dsentry.get_file_path(), outroot + '.' + outext)
+ shutil.copyfile(dsentry.get_file_path(), outroot + outext)
+ print '%s -> %s' % (dsentry.get_file_path(), outroot + outext)
# Cleanup.
dsentry.destroy()