Ticket #3487 (closed defect: fixed)

Opened 4 months ago

Last modified 4 months ago

Update Macro for full 0.11 compatibility

Reported by: dietmarw Assigned to: 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

Change History

07/31/08 08:01:37 changed by athomas

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in r4092.

07/31/08 10:41:11 changed by dietmarw

  • status changed from closed to reopened.
  • resolution deleted.
  • 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).

08/01/08 07:15:27 changed 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:

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

08/01/08 07:24:11 changed by athomas

  • status changed from reopened to closed.
  • resolution set to fixed.

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


Add/Change #3487 (Update Macro for full 0.11 compatibility)




Change Properties
Action