comparison frontends/src/jp/common.py @ 2306:07deebea71f3

jp (common): fixed the use of --last-item when "-n [node]" is used
author Goffi <goffi@goffi.org>
date Wed, 05 Jul 2017 15:04:45 +0200
parents 276e546b7619
children f15b428852a0
comparison
equal deleted inserted replaced
2305:972e33507609 2306:07deebea71f3
431 elif pubsub_item is not None: 431 elif pubsub_item is not None:
432 command = 'edit' # XXX: edit command is only used internaly, it similar to last, but with the item given in the URL 432 command = 'edit' # XXX: edit command is only used internaly, it similar to last, but with the item given in the URL
433 else: 433 else:
434 command = 'new' 434 command = 'new'
435 435
436 if self.args.last_item and command != 'last': 436 if self.args.last_item:
437 self.parser.error(_(u"--last-item can't be used with a specified item")) 437 if pubsub_item is None:
438 command = 'last'
439 elif command != 'last':
440 self.parser.error(_(u"--last-item can't be used with a specified item"))
438 441
439 if not force_item and command in ('new', 'last', 'edit'): 442 if not force_item and command in ('new', 'last', 'edit'):
440 # we need a temporary file 443 # we need a temporary file
441 tmp_suff = '.' + self.getTmpSuff() 444 tmp_suff = '.' + self.getTmpSuff()
442 content_file_obj, content_file_path = self.getTmpFile(tmp_suff) 445 content_file_obj, content_file_path = self.getTmpFile(tmp_suff)