Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Disallow item creation without any accompanying properties. |
---|---|
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
49440f6e1ff0db111897242e83a593e4 |
User & Date: | mvnathan 2014-09-20 08:38:43.810 |
Context
2014-09-20
| ||
09:42 | Implemented the new command. check-in: 1bafafa24d user: mvnathan tags: dev | |
08:38 | Disallow item creation without any accompanying properties. check-in: 49440f6e1f user: mvnathan tags: dev | |
07:51 | Implemented command-line parsing for the new command. check-in: a855b05bad user: mvnathan tags: dev | |
Changes
Changes to py/morglib/database.py.
︙ | ︙ | |||
375 376 377 378 379 380 381 382 383 384 385 386 387 388 | abbreviated. This function performs all its database operations in a transaction. Thus, any failures will roll back the Morg database to its previous state. ''' logger.info('adding new item') for p, v in properties.iteritems(): logger.debug('property {} = {}'.format(p, v)) with self._db: self.execute('insert into item default values') item_id = self._db.last_insert_rowid() | > > > > | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | abbreviated. This function performs all its database operations in a transaction. Thus, any failures will roll back the Morg database to its previous state. ''' if (not properties): msg = 'cannot create an item without any properties' raise property_error(None, None, None, msg) logger.info('adding new item') for p, v in properties.iteritems(): logger.debug('property {} = {}'.format(p, v)) with self._db: self.execute('insert into item default values') item_id = self._db.last_insert_rowid() |
︙ | ︙ |
Changes to py/morglib/new.py.
︙ | ︙ | |||
81 82 83 84 85 86 87 | help = 'range of values property may assume', metavar = 'RANGE') parser.add_argument('properties', nargs = argparse.REMAINDER, help = 'property specifications for new task', metavar = 'PROPERTIES') | | > > > | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | help = 'range of values property may assume', metavar = 'RANGE') parser.add_argument('properties', nargs = argparse.REMAINDER, help = 'property specifications for new task', metavar = 'PROPERTIES') arg = parser.parse_args(argv) if (arg.property is None and not arg.properties): raise args.args_error('cannot create item without properties') return arg def _help_before_options(): help_text = ''' Use the new command to add items or properties to the Morg database. Without any options, this command will add a new item to the database, using the positional arguments as property specifications for the item. |
︙ | ︙ |