comparison frontends/src/jp/cmd_invitation.py @ 2260:45b89d7c5c81

jp (invitation): fixed inconsistency in language handling
author Goffi <goffi@goffi.org>
date Wed, 21 Jun 2017 08:00:14 +0200
parents 6c1070ae1b7d
children 688ff67d6ae9
comparison
equal deleted inserted replaced
2259:f51315500eb1 2260:45b89d7c5c81
140 def add_parser_options(self): 140 def add_parser_options(self):
141 self.parser.add_argument("--replace", action='store_true', help='replace the whole data') 141 self.parser.add_argument("--replace", action='store_true', help='replace the whole data')
142 self.parser.add_argument("-n", "--name", type=base.unicode_decoder, default='', help='name of the invitee') 142 self.parser.add_argument("-n", "--name", type=base.unicode_decoder, default='', help='name of the invitee')
143 self.parser.add_argument("-N", "--host-name", type=base.unicode_decoder, default='', help='name of the host') 143 self.parser.add_argument("-N", "--host-name", type=base.unicode_decoder, default='', help='name of the host')
144 self.parser.add_argument("-e", "--email", type=base.unicode_decoder, default='', help='email to send the invitation to (if --no-email is set, email will just be saved)') 144 self.parser.add_argument("-e", "--email", type=base.unicode_decoder, default='', help='email to send the invitation to (if --no-email is set, email will just be saved)')
145 self.parser.add_argument("-l", "--lang", type=base.unicode_decoder, default='', help='main language spoken by the invitee') 145 self.parser.add_argument("-l", "--lang", dest="language", type=base.unicode_decoder, default='',
146 help='main language spoken by the invitee')
146 self.parser.add_argument("-x", "--extra", metavar=('KEY', 'VALUE'), type=base.unicode_decoder, action='append', nargs=2, default=[], help='extra data to associate with invitation/invitee') 147 self.parser.add_argument("-x", "--extra", metavar=('KEY', 'VALUE'), type=base.unicode_decoder, action='append', nargs=2, default=[], help='extra data to associate with invitation/invitee')
147 self.parser.add_argument("-p", "--profile", type=base.unicode_decoder, default='', help="profile doing the invitation (default: don't associate profile") 148 self.parser.add_argument("-p", "--profile", type=base.unicode_decoder, default='', help="profile doing the invitation (default: don't associate profile")
148 self.parser.add_argument("id", type=base.unicode_decoder, 149 self.parser.add_argument("id", type=base.unicode_decoder,
149 help=_(u"invitation UUID")) 150 help=_(u"invitation UUID"))
150 151
157 reason=failure_), error=True) 158 reason=failure_), error=True)
158 self.host.quit(C.EXIT_BRIDGE_ERRBACK) 159 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
159 160
160 def start(self): 161 def start(self):
161 extra = dict(self.args.extra) 162 extra = dict(self.args.extra)
162 for arg_name in ('name', 'host_name', 'email', 'lang', 'profile'): 163 for arg_name in ('name', 'host_name', 'email', 'language', 'profile'):
163 value = getattr(self.args, arg_name) 164 value = getattr(self.args, arg_name)
164 if not value: 165 if not value:
165 continue 166 continue
166 if arg_name in extra: 167 if arg_name in extra:
167 self.parser.error(_(u"you can't set {arg_name} in both optional argument and extra").format(arg_name=arg_name)) 168 self.parser.error(_(u"you can't set {arg_name} in both optional argument and extra").format(arg_name=arg_name))