frontends (jp/blog), plugin blog_import: fixes:
- argparse argument with nargs > 1 and default == {} crashes when reading the user input
- separate blog import options with a new line
- convert DBus strings received by the backend to unicode
This commit is contained in:
parent
12a18b9d51
commit
0eaf531608
1 changed files with 5 additions and 4 deletions
|
|
@ -37,7 +37,7 @@ class Import(base.CommandBase):
|
|||
self.parser.add_argument('--no-images-upload', action='store_true', help=_(u"do *NOT* upload images (default: do upload images)"))
|
||||
self.parser.add_argument('--upload-ignore-host', help=_(u"do not upload images from this host (default: upload all images)"))
|
||||
self.parser.add_argument("--ignore-tls-errors", action="store_true", help=_("ignore invalide TLS certificate for uploads"))
|
||||
self.parser.add_argument('-o', '--option', action='append', nargs=2, default={}, metavar=(u'NAME', u'VALUE'),
|
||||
self.parser.add_argument('-o', '--option', action='append', nargs=2, default=[], metavar=(u'NAME', u'VALUE'),
|
||||
help=_(u"importer specific options (see importer description)"))
|
||||
self.parser.add_argument('--service', type=base.unicode_decoder, default=u'', metavar=u'PUBSUB_SERVICE',
|
||||
help=_(u"PubSub service where the items must be uploaded (default: server)"))
|
||||
|
|
@ -77,7 +77,7 @@ class Import(base.CommandBase):
|
|||
if getattr(self.args, name):
|
||||
self.parser.error(_(u"{name} argument can't be used without location argument").format(name=name))
|
||||
if self.args.importer is None:
|
||||
print u''.join([u'{}: {}'.format(name, desc) for name, desc in self.host.bridge.blogImportList()])
|
||||
print u'\n'.join([u'{}: {}'.format(name, desc) for name, desc in self.host.bridge.blogImportList()])
|
||||
else:
|
||||
try:
|
||||
short_desc, long_desc = self.host.bridge.blogImportDesc(self.args.importer)
|
||||
|
|
@ -90,7 +90,7 @@ class Import(base.CommandBase):
|
|||
self.host.quit()
|
||||
else:
|
||||
# we have a location, an import is requested
|
||||
options = dict(self.args.option)
|
||||
options = {key: value for key, value in self.args.option}
|
||||
if self.args.host:
|
||||
options['host'] = self.args.host
|
||||
if self.args.ignore_tls_errors:
|
||||
|
|
|
|||
Loading…
Reference in a new issue