Changeset 3179

Show
Ignore:
Timestamp:
02/05/08 10:05:21 (1 month ago)
Author:
bobbysmith007
Message:

re #2519 T&E for trac 11 version 0.6.1

I concluded that the logic to figure out when to upgrade reports was fairly incorrect and so rewrote what I hope will be a better fucntion for this. I also added some more logging statements to help debug this in the future

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • timingandestimationplugin/branches/trac0.11/setup.py

    r3119 r3179  
    88      description='Plugin to make Trac support time estimation and tracking', 
    99      keywords='trac plugin estimation timetracking', 
    10       version='0.6.0', 
     10      version='0.6.1', 
    1111      url='http://www.trac-hacks.org/wiki/TimingAndEstimationPlugin', 
    1212      license='http://www.opensource.org/licenses/mit-license.php', 
  • timingandestimationplugin/branches/trac0.11/timingandestimationplugin/api.py

    r3119 r3179  
    138138            for report in report_group['reports']: 
    139139                db_reports.add((report['uuid'], report['version'])) 
    140         return len(db_reports.symmetric_difference(py_reports)) > 0 
     140        #diff = db_reports.symmetric_difference(py_reports) 
     141 
     142        # the things in the python reports that are not in the database 
     143        diff = py_reports.difference(db_reports) 
     144        for py in diff.copy(): 
     145            for db in db_reports: 
     146                #if we have the same report and the db has a higher version 
     147                # remove it from the difference 
     148                if db[0] == py[0] && db[1] >= py[1] : 
     149                    diff.remove(py); 
     150        if len(diff) > 0: 
     151            self.log.debug ("T&E needs upgrades for the following reports: %s" % diff ) 
     152        return len(diff) > 0 
    141153         
    142154    def do_reports_upgrade(self, force=False): 
  • timingandestimationplugin/branches/trac0.11/timingandestimationplugin/reportmanager.py

    r2823 r3179  
    102102    # First check to see if we can load an existing version of this report 
    103103    (id, currentversion) = self.get_report_id_and_version(uuid) 
     104    self.log.error("add_report %s (ver:%s) | id: %s currentversion: %s" % (uuid , version, id, currentversion)) 
    104105    try: 
    105106      if not id: 
     
    116117      self.log.error("CustomReportManager.add_report Exception: %s, %s" % (e,(title, author, uuid, version, 
    117118                 maingroup, subgroup, force))); 
     119    self.log.debug("report %s not upgraded (a better version already exists)" % uuid) 
    118120    return False 
    119121