Index: /trunk/ChangeLog =================================================================== --- /trunk/ChangeLog (revision 631) +++ /trunk/ChangeLog (revision 632) @@ -1,2 +1,6 @@ +2.X.X + * Also made delete_spam virtual env aware + Fixed by: Bas van der Vlies + 2.7.0 * use self.env.get_read_db for trac version > 0.11. self.env.get_db_cnx is obsolete. TRAC Index: /trunk/delete_spam.py.in =================================================================== --- /trunk/delete_spam.py.in (revision 631) +++ /trunk/delete_spam.py.in (revision 632) @@ -42,6 +42,4 @@ import shutil import ConfigParser - -from trac import __version__ as trac_version def ReadConfig(file, name): @@ -122,4 +120,6 @@ # configfile = '@email2trac_conf@' + virtualenv = '@virtualenv@' + @@ -148,10 +148,29 @@ VERBOSE = True + + if virtualenv and os.path.exists(virtualenv): + activate_this = os.path.join(virtualenv, 'bin/activate_this.py') + if os.path.exists(activate_this): + execfile(activate_this, dict(__file__=activate_this)) + + + try: + from trac import __version__ as trac_version + from trac import config as trac_config + from trac.env import Environment + from trac.ticket import Ticket + from trac import util + + except ImportError, detail: + print "Can not find a a valid trac installation, solutions could be:" + print "\tset PYTHONPATH" + print "\tuse the --virtualenv