[Bugs] #586 UNSP: Browse cannot upload activity bundles to activities.sugarlabs.org because of Journal name scrambling.
SugarLabs Bugs
bugtracker-noreply at sugarlabs.org
Wed Apr 1 05:37:12 EDT 2009
#586: Browse cannot upload activity bundles to activities.sugarlabs.org because
of Journal name scrambling.
------------------------------------------+---------------------------------
Reporter: wadeb | Owner: tomeu
Type: defect | Status: new
Priority: Unspecified by Maintainer | Milestone: 0.84
Component: sugar | Version: 0.82.x
Severity: Blocker | Resolution:
Keywords: | Distribution: Unspecified
Status_field: Unconfirmed |
------------------------------------------+---------------------------------
Comment(by tomeu):
Replying to [comment:5 wadeb]:
>
> Is there any way that copy-to-journal could automatically detect the
mime type from the file extension?
Would this modification work? (I haven't tested it)
{{{
diff --git a/bin/copy-to-journal b/bin/copy-to-journal
index ce72f2b..1a3d14d 100755
--- a/bin/copy-to-journal
+++ b/bin/copy-to-journal
@@ -15,10 +15,11 @@ if os.path.exists("/tmp/olpc-session-bus"):
os.environ["DBUS_SESSION_BUS_ADDRESS"] = "unix:path=/tmp/olpc-
session-bus"
from sugar.datastore import datastore
+from sugar import mime
def build_option_parser():
- usage = "Usage: %prog <file> -m MIMETYPE [-t TITLE] [-d DESC] [-T
tag1 [-T tag2 ...]]"
+ usage = "Usage: %prog <file> [-m MIMETYPE] [-t TITLE] [-d DESC] [-T
tag1 [-T tag2 ...]]"
parser = optparse.OptionParser(usage=usage)
parser.add_option("-t", "--title", action="store", dest="title",
@@ -52,17 +53,15 @@ if __name__ == "__main__":
parser.print_help()
exit(0)
- if not options.mimetype:
- print 'Error: No MIME-type given.'
- parser.print_help()
- exit(0)
-
try:
entry = datastore.create()
entry.set_file_path(absname)
# Set the mimetype to the provided one.
- entry.metadata['mime_type'] = options.mimetype
+ if options.mimetype is None:
+ entry.metadata['mime_type'] = mime.get_for_file(absname)
+ else:
+ entry.metadata['mime_type'] = options.mimetype
# If no title is given, use the filename.
if options.title:
}}}
> IE, is there a Unix command which can attempt to do that based on the
MIME types DB?
Should be one, maybe one of the xdg-* commands?
--
Ticket URL: <http://dev.sugarlabs.org/ticket/586#comment:6>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system
More information about the Bugs
mailing list