Modify

Opened 8 years ago

Closed 7 years ago

#13175 closed defect (fixed)

Make compatible with Trac 1.2

Reported by: Darren Owned by: Ryan J Ollos
Priority: normal Component: TracJsGanttPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.2

Description

TracJsGanttPlugin does not work in 1.2 changing get_db_cnx to get_read_db in tracjsgantt.py and tracpm.py seems to help make it display, but all tasks seem to be 2 days.

Attachments (1)

tracjsganttplugin#13175.diff (1.8 KB) - added by Rochi 7 years ago.
Patch

Download all attachments as: .zip

Change History (7)

comment:1 Changed 8 years ago by Ryan J Ollos

Keywords: 1.2 gantt timing removed
Summary: TracJsGanttPluginMake compatible with Trac 1.2

Please use a summary that is consistent with your request.

comment:2 Changed 7 years ago by Rochi

Patch for DB API 1.2 and datetime support

  • tracjsgantt.py

    old new  
    406406
    407407        def _buildEnumMap(field):
    408408            self.classMap = {}
    409             db = self.env.get_db_cnx()
    410             cursor = db.cursor()
    411             cursor.execute("SELECT name," +
     409           with self.env.db_query as db:
     410               cursor = db.cursor()
     411               cursor.execute("SELECT name," +
    412412                           db.cast('value', 'int') +
    413413                           " FROM enum WHERE type=%s", (field,))
    414             for name, value in cursor:
    415                 self.classMap[name] = value
     414               for name, value in cursor:
     415                       self.classMap[name] = value
    416416
    417417        display = None
    418418        colorBy = options['colorBy']
  • tracpm.py

    old new  
    324324    # otherwise.
    325325    def isSet(self, ticket, field):
    326326        if self.isCfg(field) \
    327                 and len(ticket[self.fields[field]]) != 0:
     327                and isinstance(ticket[self.fields[field]], datetime) and len(str(ticket[self.fields[field]])) != 0:
    328328            return True
     329       elif self.isCfg(field) \
     330               and len(ticket[self.fields[field]]) != 0:
     331           return True
    329332        else:
    330333            return False
    331334
     
    336339        if not dateString:
    337340            d = None
    338341        else:
    339             d = datetime(*time.strptime(dateString,
     342           if isinstance(dateString, datetime):
     343               d = dateString
     344            else:
     345               d = datetime(*time.strptime(dateString,
    340346                                        self.dbDateFormat)[0:7])
    341347            d = d.replace(hour=0, minute=0, second=0, microsecond=0,
    342348                          tzinfo=localtz)

The patch is not tested yet, but seems to work at first glance.

I will test the patch the next few days.

comment:3 Changed 7 years ago by Ryan J Ollos

Please attach proposed changes as a patch file (TracDev/SubmittingPatches).

Changed 7 years ago by Rochi

Patch

comment:4 Changed 7 years ago by Ryan J Ollos

Owner: changed from Chris Nelson to Ryan J Ollos
Status: newaccepted

comment:5 Changed 7 years ago by Ryan J Ollos

In 17149:

Trac-jsGantt 1.2.0.0dev: Branch for Trac 1.2 and conform to PEP8

Refs #13175.

comment:6 Changed 7 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 17150:

Trac-jsGantt 1.2.0.0dev: Make compatible with Trac 1.2+

Fixes #13175.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.