Modify

Opened 9 months ago

Last modified 8 months ago

#14106 new defect

TemplateSyntaxError: Encountered unknown tag 'time', whenever TracHoursSidebarProvider is enabled.

Reported by: anonymous Owned by: EmeCas
Priority: normal Component: TracHoursPlugin
Severity: normal Keywords: patch
Cc: Trac Release: 1.4

Description (last modified by Ryan J Ollos)

I know probably is an installation problem. I have already reinstalled TracHoursPlugin and dependencies two times but I can't find what I'm doing wrong.

Attachments (2)

sidebar.png (41.2 KB) - added by jdelosmozos@… 8 months ago.
sidebar-correct.png (52.1 KB) - added by jdelosmozos@… 8 months ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 9 months ago by Ryan J Ollos

Description: modified (diff)

Changed 8 months ago by jdelosmozos@…

Attachment: sidebar.png added

Changed 8 months ago by jdelosmozos@…

Attachment: sidebar-correct.png added

comment:2 Changed 8 months ago by anonymous

I am not a trac developer at all, so please correct me if I'm worng, but it seems like this is a compatibility issue. As per my investigation Trac 1.4 uses Jinja2 and latest version of TicketSidebarProviderPlugin was designed to use Genshi.

As per Trac documentation you can use a backward compatibility mode until version 1.5. I've just hacked trachours/web_ui.py using this trick in content method of TracHoursSidebarProvider class:

return Chrome(self.env). \
            load_template('hours_sidebar.html',text=None).generate(**data)

The result is this. Apparently is working but I'm going to do some tests.

comment:3 Changed 8 months ago by jdelosmozos@…

Adding hours through the sidebar form results in a CRSF error.

To correct that I have included the request token in the template data in trachours/web_ui.py:

        data = {'worker': req.authname,
                'action': req.href('hours', ticket.id),
                'token': req.form_token }

I have also changed the template so that it send the token:

      <input type="hidden" name="worker" value="${worker}"/>
      <input type="hidden" name="__FORM_TOKEN" value="${token}"/>
      <input type="submit" name="addhours" value="Add Hours"/>

With these two changes everything is working fine so far.

comment:4 Changed 8 months ago by figaro

Keywords: patch added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain EmeCas.

Add Comment


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

 
Note: See TracTickets for help on using tickets.