Code

Saving, running & editing queries.
[roundup.git] / roundup / admin.py
index 8f086f35e8a508b362e932b87cbde49c08daa0c2..b8cfb840bb81fce6cfcd55b24849d76940b65354 100644 (file)
@@ -16,7 +16,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: admin.py,v 1.14 2002-06-11 06:41:50 richard Exp $
+# $Id: admin.py,v 1.17 2002-07-14 06:05:50 richard Exp $
 
 import sys, os, getpass, getopt, re, UserDict, shlex, shutil
 try:
@@ -24,6 +24,7 @@ try:
 except ImportError:
     csv = None
 from roundup import date, hyperdb, roundupdb, init, password, token
+from roundup import __version__ as roundup_version
 import roundup.instance
 from roundup.i18n import _
 
@@ -955,14 +956,23 @@ Date format is "YYYY-MM-DD" eg:
             raise ValueError, _('Invalid format')
         m = m.groupdict()
         if m['period']:
-            # TODO: need to fix date module.  one should be able to say
-            # pack_before = date.Date(". - %s"%value)
-            pack_before = date.Date(".") + date.Interval("- %s"%value)
+            pack_before = date.Date(". - %s"%value)
         elif m['date']:
             pack_before = date.Date(value)
         self.db.pack(pack_before)
         return 0
 
+    def do_reindex(self, args):
+        '''Usage: reindex
+        Re-generate an instance's search indexes.
+
+        This will re-generate the search indexes for an instance. This will
+        typically happen automatically.
+        '''
+        self.db.indexer.force_reindex()
+        self.db.reindex()
+        return 0
+
     def run_command(self, args):
         '''Run a single command
         '''
@@ -1045,7 +1055,7 @@ Date format is "YYYY-MM-DD" eg:
     def interactive(self):
         '''Run in an interactive mode
         '''
-        print _('Roundup {version} ready for input.')
+        print _('Roundup %s ready for input.'%roundup_version)
         print _('Type "help" for help.')
         try:
             import readline
@@ -1113,6 +1123,17 @@ if __name__ == '__main__':
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.16  2002/07/09 04:19:09  richard
+# Added reindex command to roundup-admin.
+# Fixed reindex on first access.
+# Also fixed reindexing of entries that change.
+#
+# Revision 1.15  2002/06/17 23:14:44  richard
+# . #569415 ] {version}
+#
+# Revision 1.14  2002/06/11 06:41:50  richard
+# Removed prompt for admin email in initialisation.
+#
 # Revision 1.13  2002/05/30 23:58:14  richard
 # oops
 #