Mercurial > libervia-backend
comparison src/plugins/plugin_blog_import.py @ 1839:cdecf553e051
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
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 04 Feb 2016 11:44:43 +0100 |
parents | 68c0dc13d821 |
children | 489b968b3723 |
comparison
equal
deleted
inserted
replaced
1838:b3b25dbac585 | 1839:cdecf553e051 |
---|---|
92 else: | 92 else: |
93 return importer.short_desc, importer.long_desc | 93 return importer.short_desc, importer.long_desc |
94 | 94 |
95 def _blogImport(self, name, location, options, pubsub_service='', profile=C.PROF_KEY_DEFAULT): | 95 def _blogImport(self, name, location, options, pubsub_service='', profile=C.PROF_KEY_DEFAULT): |
96 client = self.host.getClient(profile) | 96 client = self.host.getClient(profile) |
97 options = {key: unicode(value) for key, value in options.iteritems()} | |
97 for option in BOOL_OPTIONS: | 98 for option in BOOL_OPTIONS: |
98 try: | 99 try: |
99 options[option] = C.bool(options[option]) | 100 options[option] = C.bool(options[option]) |
100 except KeyError: | 101 except KeyError: |
101 pass | 102 pass |
102 return self.blogImport(client, name, location, options) | 103 return self.blogImport(client, unicode(name), unicode(location), options) |
103 | 104 |
104 @defer.inlineCallbacks | 105 @defer.inlineCallbacks |
105 def blogImport(self, client, name, location, options=None, pubsub_service=None): | 106 def blogImport(self, client, name, location, options=None, pubsub_service=None): |
106 """Import a blog | 107 """Import a blog |
107 | 108 |