Opened 18 years ago
Closed 18 years ago
#28 closed defect (fixed)
Context() object can't be used from Trac
Reported by: | cboos | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | 0.2 |
Component: | Template processing | Version: | 0.1 |
Keywords: | Cc: |
Description
The latest Trac markup sandbox [trac 3612] and latest Markup [197] fails with this error:
Traceback (most recent call last): File "C:\Workspace\install\lib\python\trac\devel\Lib\site-packages\trac\web\main.py", line 344, in dispatch_request dispatcher.dispatch(req) File "C:\Workspace\install\lib\python\trac\devel\Lib\site-packages\trac\web\main.py", line 233, in dispatch content_type, data) File "C:\Workspace\install\lib\python\trac\devel\Lib\site-packages\trac\web\chrome.py", line 372, in render_response return stream.render(method, doctype=doctype) File "markup\core.py", line 92, in render File "markup\output.py", line 205, in __call__ File "markup\output.py", line 498, in next File "markup\output.py", line 443, in __call__ File "markup\core.py", line 149, in _ensure File "c:\workspace\src\trac\markup\trunk\markup\filters.py", line 147, in __call__ for kind, data, pos in stream: File "c:\workspace\src\trac\markup\trunk\markup\template.py", line 920, in _flatten for kind, data, pos in stream: File "c:\workspace\src\trac\markup\trunk\markup\template.py", line 938, in _match match_templates = ctxt._match_templates AttributeError: 'Context' object has no attribute '_match_templates'
The following change fixes it:
-
markup/template.py
103 103 self.frames = deque([data]) 104 104 self.pop = self.frames.popleft 105 105 self.push = self.frames.appendleft 106 self._match_templates = [] 106 107 107 108 def __repr__(self): 108 109 return repr(self.frames) … … 852 853 assert isinstance(ctxt, Context) 853 854 else: 854 855 ctxt = Context(**kwargs) 855 ctxt._match_templates = []856 856 857 857 stream = self.stream 858 858 for filter_ in [self._eval, self._match, self._flatten] + self.filters:
Change History (2)
comment:1 Changed 18 years ago by cmlenz
comment:2 Changed 18 years ago by cmlenz
- Resolution set to fixed
- Status changed from new to closed
Okay, I've fixed up the Trac-with-Markup branch, but also applied your patch in [199]. Seemed like a good idea in any case. Thanks!
Note: See
TracTickets for help on using
tickets.
I think this actually needs to be fixed in the Trac branch, admittedly caused by a backwards incompatible change in Markup in [191]. I'll look into that.