Modify

Opened 6 years ago

Closed 6 years ago

#3487 closed defect (fixed)

Update Macro for full 0.11 compatibility

Reported by: dietmarw Owned by: athomas
Priority: normal Component: PollMacro
Severity: normal Keywords: 0.11
Cc: Trac Release: 0.11

Description

Hi,
I just found this nice Macro and it does exactly what I was looking for. It runs in my 0.11 installation but triggers the pre-0.11 warning. Also the reference of tickets does not work in 0.11 (I don't mind that since I probably won't use this). I don't know if this has something to do with 0.11 or if it's a bug in in itself.

When I enter this example

[[Poll(Which of these do you prefer?; #1; #2; #3; Cheese dip)]]

I get this error message displayed:

Error: Macro Poll(Which of these do you prefer?; #1; #2; #3; Cheese dip) failed

'NoneType' object has no attribute 'ticket'

Thanks,
Dietmar

Attachments (0)

Change History (4)

comment:1 Changed 6 years ago by athomas

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r4092.

comment:2 Changed 6 years ago by dietmarw

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Summary changed from Any chance of an update of this Macro for more 0.11 compatibility? to Update Macro for full 0.11 compatibility

r4092 fixes the ticket and reference errors but the macro still triggers a pre-0.11 warning:

WARNING: Executing pre-0.11 Wiki macro Poll by provider <class 'tracpoll.tracpoll.PollMacro'+

The legacy support will stop in 0.12 at which time this macro will not work any more
(see also line 156 of formatter.py and line 61 of macros.py).

comment:3 Changed 6 years ago by dietmarw

OK I had a look around and actually managed to get rid of the warnings (solutions found in trac:ticket:4568 and this Wiki page).

I created the following patch which hopefully will be accepted:

  • tracpoll/tracpoll.py

     diff --git a/tracpoll/tracpoll.py b/tracpoll/tracpoll.py
    index c0dfe62..927d2ae 100644
    a b class PollMacro(WikiMacroBase): 
    121121    base_dir = Option('poll', 'base_dir', '/tmp', 
    122122                      'Path where poll pickle dumps should be stored.') 
    123123 
    124     def render_macro(self, req, name, content): 
     124    def expand_macro(self, formatter, name, content): 
     125        req = formatter.req 
    125126        content = filter(None, [i.strip() for i in 
    126127                                content.replace(';', '\n').split('\n')]) 
    127128        title = content.pop(0) 

comment:4 Changed 6 years ago by athomas

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [4103]) Applied patch from dietmarw. Thanks! Fixes #3487.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.