Mercurial > p > roundup > code
comparison roundup/admin.py @ 880:de3da99a7c02
Add Number and Boolean types to hyperdb.
Add conversion cases to web, mail & admin interfaces.
Add storage/serialization cases to back_anydbm & back_metakit.
| author | Gordon B. McMillan <gmcm@users.sourceforge.net> |
|---|---|
| date | Thu, 18 Jul 2002 11:17:31 +0000 |
| parents | 68cef2bb929d |
| children | b0d3d3535998 |
comparison
equal
deleted
inserted
replaced
| 878:8828f0f2e825 | 880:de3da99a7c02 |
|---|---|
| 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 18 # | 18 # |
| 19 # $Id: admin.py,v 1.17 2002-07-14 06:05:50 richard Exp $ | 19 # $Id: admin.py,v 1.18 2002-07-18 11:17:30 gmcm Exp $ |
| 20 | 20 |
| 21 import sys, os, getpass, getopt, re, UserDict, shlex, shutil | 21 import sys, os, getpass, getopt, re, UserDict, shlex, shutil |
| 22 try: | 22 try: |
| 23 import csv | 23 import csv |
| 24 except ImportError: | 24 except ImportError: |
| 437 raise UsageError, '"%s": %s'%(value, message) | 437 raise UsageError, '"%s": %s'%(value, message) |
| 438 elif isinstance(proptype, hyperdb.Link): | 438 elif isinstance(proptype, hyperdb.Link): |
| 439 props[key] = value | 439 props[key] = value |
| 440 elif isinstance(proptype, hyperdb.Multilink): | 440 elif isinstance(proptype, hyperdb.Multilink): |
| 441 props[key] = value.split(',') | 441 props[key] = value.split(',') |
| 442 elif isinstance(proptype, hyperdb.Boolean): | |
| 443 props[key] = value.lower() in ('yes', 'true', 'on', '1') | |
| 444 elif isinstance(proptype, hyperdb.Number): | |
| 445 props[key] = int(value) | |
| 442 | 446 |
| 443 # try the set | 447 # try the set |
| 444 try: | 448 try: |
| 445 apply(cl.set, (nodeid, ), props) | 449 apply(cl.set, (nodeid, ), props) |
| 446 except (TypeError, IndexError, ValueError), message: | 450 except (TypeError, IndexError, ValueError), message: |
| 609 raise UsageError, _('"%(value)s": %(message)s')%locals() | 613 raise UsageError, _('"%(value)s": %(message)s')%locals() |
| 610 elif isinstance(proptype, hyperdb.Password): | 614 elif isinstance(proptype, hyperdb.Password): |
| 611 props[propname] = password.Password(value) | 615 props[propname] = password.Password(value) |
| 612 elif isinstance(proptype, hyperdb.Multilink): | 616 elif isinstance(proptype, hyperdb.Multilink): |
| 613 props[propname] = value.split(',') | 617 props[propname] = value.split(',') |
| 618 elif isinstance(proptype, hyperdb.Boolean): | |
| 619 props[propname] = value.lower() in ('yes', 'true', 'on', '1') | |
| 620 elif isinstance(proptype, hyperdb.Number): | |
| 621 props[propname] = int(value) | |
| 614 | 622 |
| 615 # check for the key property | 623 # check for the key property |
| 616 propname = cl.getkey() | 624 propname = cl.getkey() |
| 617 if propname and not props.has_key(propname): | 625 if propname and not props.has_key(propname): |
| 618 raise UsageError, _('you must provide the "%(propname)s" ' | 626 raise UsageError, _('you must provide the "%(propname)s" ' |
| 1121 tool = AdminTool() | 1129 tool = AdminTool() |
| 1122 sys.exit(tool.main()) | 1130 sys.exit(tool.main()) |
| 1123 | 1131 |
| 1124 # | 1132 # |
| 1125 # $Log: not supported by cvs2svn $ | 1133 # $Log: not supported by cvs2svn $ |
| 1134 # Revision 1.17 2002/07/14 06:05:50 richard | |
| 1135 # . fixed the date module so that Date(". - 2d") works | |
| 1136 # | |
| 1126 # Revision 1.16 2002/07/09 04:19:09 richard | 1137 # Revision 1.16 2002/07/09 04:19:09 richard |
| 1127 # Added reindex command to roundup-admin. | 1138 # Added reindex command to roundup-admin. |
| 1128 # Fixed reindex on first access. | 1139 # Fixed reindex on first access. |
| 1129 # Also fixed reindexing of entries that change. | 1140 # Also fixed reindexing of entries that change. |
| 1130 # | 1141 # |
