Ticket #10718 (closed enhancement: fixed)

Opened 5 months ago

Last modified 5 months ago

[PATCH] make it working with Trac-1.0

Reported by: falkb Assigned to: rjollos
Priority: normal Component: WikiTableMacro
Severity: normal Keywords:
Cc: hasienda Trac Release: 1.0

Description

Trying today's SVN revision of this plugin I noticed it doesn't work with Trac 1.0, just strange errors like "... macro ... no longer supported ..." appear as desribed here.

I was able to fix it for me with the hint of hasienda. It works for me now on Trac-1.0.0. Here are my 2 little patches:

Index: wikitablemacro/0.11/wikitable/table.py
===================================================================
--- wikitablemacro/0.11/wikitable/table.py	(revision 12447)
+++ wikitablemacro/0.11/wikitable/table.py	(working copy)
@@ -33,10 +33,12 @@
     
     # Render macro
     
-    def render_macro(self, req, name, content):
+    def expand_macro(self, formatter, name, content):
         db = self.env.get_db_cnx()
         cursor = db.cursor()
         cursor.execute(content)
+
+        req = formatter.req
         
         out = StringIO()
Index: wikitablemacro/0.11/wikitable/scalar.py
===================================================================
--- wikitablemacro/0.11/wikitable/scalar.py	(revision 12447)
+++ wikitablemacro/0.11/wikitable/scalar.py	(working copy)
@@ -23,7 +23,7 @@
     
     # Render macro
     
-    def render_macro(self, req, name, content):
+    def expand_macro(self, formatter, name, content):
         db = self.env.get_db_cnx()
         cursor = db.cursor()
         cursor.execute(content)
@@ -36,5 +36,5 @@
 	out = StringIO() 
 	print >>out, u"<span class='wikiscalar'>%s</span>" % value
 
-        add_stylesheet(req, 'wikitable/css/wikitable.css')
+        add_stylesheet(formatter.req, 'wikitable/css/wikitable.css')
         return Markup(out.getvalue())

Attachments

Change History

12/19/12 08:55:35 changed by rjollos

  • status changed from new to assigned.

12/19/12 09:40:47 changed by rjollos

The patch looks great. I will commit it after I get some sleep :)

12/21/12 12:22:23 changed by rjollos

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

(In [12455]) Fixes #10718 (0.2dev): Use Trac 0.11+ API, replacing implementation of render_macro with expand_macro.


Add/Change #10718 ([PATCH] make it working with Trac-1.0)




Change Properties
Action