Discussion:
misc bugs...
Chris McDonough
2008-09-06 22:08:54 UTC
Permalink
Hi Malthe and all...

I found two niggly bugs in z3c.pt.

The first is that when you make an attribute assignment via the TAL parser ala:

<a tal:attributes="href info.submit_url"/>

You'll wind up with an assignment declaration that's something like:

href = fo.submit_url

This is due to this code in expressions.py:

elif token.startswith('in'):
i += 2

I'm not sure what this is checking for, but I ventured a guess at:

elif token.startswith('in '):
i += 3

Which indeed solves the issue.

The second is that this line in translation.py (~223):

variable = self.symbols.slot+element.node.fill_slot

Sometimes fails because element.node.fill_slot is None. I have no idea why, but
I worked around it by adding the following code above that line:

if element.node.fill_slot is None:
# XXX this should not be necessary, but the above
# xpath expression finds non-fill-slot nodes somehow
continue

I'm not confident enough to check either fix in, because I don't understand what
the first is testing for, and I haven't had the time to backtrace the fill_slot
thing yet.

- C

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "z3c.pt" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to z3c_pt+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/z3c_pt?hl=en
-~----------~----~----~----~------~----~------~--~---
Chris McDonough
2008-09-06 22:39:09 UTC
Permalink
Note also that using the cached representation of files (e.g. in a process
started without Z3C_PT_CACHE=false) doesn't appear to work very well on the
trunk. When using it "for real" (with macros and ZPT, at least), after a
restart, you wind up with errors like the below. Turning the file cache off
solves this problem.

Traceback (most recent call last):
File
"/Users/chrism/projects/ehs/bfgenv/eggs/repoze.errorlog-0.7-py2.5.egg/repoze/errorlog/__init__.py",
line 85, in __call__
return self.application(environ, start_response)
File
"/Users/chrism/projects/ehs/bfgenv/eggs/repoze.tm2-1.0a2-py2.5.egg/repoze/tm/__init__.py",
line 19, in __call__
result = self.application(environ, save_status_and_headers)
File
"/Users/chrism/projects/ehs/bfgenv/eggs/repoze.who-1.0.5-py2.5.egg/repoze/who/middleware.py",
line 105, in __call__
app_iter = app(environ, wrapper.wrap_start_response)
File "/Users/chrism/projects/ehs/bfgenv/src/repoze.bfg/repoze/bfg/router.py",
line 48, in __call__
secure=True)
File "/Users/chrism/projects/ehs/bfgenv/src/repoze.bfg/repoze/bfg/view.py",
line 30, in render_view_to_response
return queryMultiAdapter((context, request), IView, name=name)
File
"/Users/chrism/projects/ehs/bfgenv/eggs/zope.component-3.4.0-py2.5.egg/zope/component/_api.py",
line 114, in queryMultiAdapter
return sitemanager.queryMultiAdapter(objects, interface, name, default)
File
"/Users/chrism/projects/ehs/bfgenv/eggs/zope.component-3.4.0-py2.5.egg/zope/component/registry.py",
line 207, in queryMultiAdapter
objects, interface, name, default)
File
"/Users/chrism/projects/ehs/bfgenv/eggs/zope.interface-3.4.1-py2.5-macosx-10.3-i386.egg/zope/interface/adapter.py",
line 482, in queryMultiAdapter
result = factory(*objects)
File
"/Users/chrism/projects/ehs/bfgenv/src/submission/submission/views/submit.py",
line 299, in add_frames
management = Management(context, request)
File
"/Users/chrism/projects/ehs/bfgenv/src/submission/submission/views/management.py",
line 30, in __init__
self.main = get_template(main)
File
"/Users/chrism/projects/ehs/bfgenv/src/repoze.bfg/repoze/bfg/template.py", line
92, in get_template
return _get_template(path).template
File
"/Users/chrism/projects/ehs/bfgenv/src/repoze.bfg/repoze/bfg/template.py", line
83, in _get_template
template = Z3CPTTemplateFactory(path, auto_reload)
File
"/Users/chrism/projects/ehs/bfgenv/src/repoze.bfg/repoze/bfg/template.py", line
25, in __init__
self.template = PageTemplateFile(path, auto_reload=auto_reload)
File
"/Users/chrism/projects/ehs/bfgenv/src/z3c.pt/src/z3c/pt/pagetemplate.py", line
48, in __init__
doctype, **kwargs)
File "/Users/chrism/projects/ehs/bfgenv/src/z3c.pt/src/z3c/pt/template.py",
line 105, in __init__
filename, filecache.TemplateCache(filename))
File "/Users/chrism/projects/ehs/bfgenv/src/z3c.pt/src/z3c/pt/filecache.py",
line 9, in __init__
self.load()
File "/Users/chrism/projects/ehs/bfgenv/src/z3c.pt/src/z3c/pt/filecache.py",
line 37, in load
self.registry = pickle.load(f)
File "/Users/chrism/projects/ehs/bfgenv/src/z3c.pt/src/z3c/pt/translation.py",
line 589, in __setstate__
self.__dict__.update(GhostedByteCodeTemplate.rebuild(state))
File "/Users/chrism/projects/ehs/bfgenv/src/z3c.pt/src/z3c/pt/translation.py",
line 630, in rebuild
root, doctype = state['parser'].parse(state['xmldoc'])
File "/Users/chrism/projects/ehs/bfgenv/src/z3c.pt/src/z3c/pt/zpt.py", line
215, in parse
root, doctype = super(ZopePageTemplateParser, self).parse(body)
File "/Users/chrism/projects/ehs/bfgenv/src/z3c.pt/src/z3c/pt/etree.py", line
23, in parse
return parse(body, self.element_mapping)
File "/Users/chrism/projects/ehs/bfgenv/src/z3c.pt/src/z3c/pt/etree.py", line
171, in parse
tree = lxml.etree.parse(StringIO(body), parser)
File "lxml.etree.pyx", line 2576, in lxml.etree.parse
(src/lxml/lxml.etree.c:22796)
File "parser.pxi", line 1483, in lxml.etree._parseDocument
(src/lxml/lxml.etree.c:60359)
File "parser.pxi", line 1511, in lxml.etree._parseMemoryDocument
(src/lxml/lxml.etree.c:60613)
File "parser.pxi", line 1390, in lxml.etree._parseDoc
(src/lxml/lxml.etree.c:59530)
File "parser.pxi", line 932, in lxml.etree._BaseParser._parseDoc
(src/lxml/lxml.etree.c:56815)
File "parser.pxi", line 538, in
lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:53512)
File "parser.pxi", line 624, in lxml.etree._handleParseResult
(src/lxml/lxml.etree.c:54372)
File "parser.pxi", line 564, in lxml.etree._raiseParseError
(src/lxml/lxml.etree.c:53770)
XMLSyntaxError: Attribute xmlns redefined, line 1, column 63
Post by Chris McDonough
Hi Malthe and all...
I found two niggly bugs in z3c.pt.
<a tal:attributes="href info.submit_url"/>
href = fo.submit_url
i += 2
i += 3
Which indeed solves the issue.
variable = self.symbols.slot+element.node.fill_slot
Sometimes fails because element.node.fill_slot is None. I have no idea why, but
# XXX this should not be necessary, but the above
# xpath expression finds non-fill-slot nodes somehow
continue
I'm not confident enough to check either fix in, because I don't understand what
the first is testing for, and I haven't had the time to backtrace the fill_slot
thing yet.
- C
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "z3c.pt" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to z3c_pt+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/z3c_pt?hl=en
-~----------~----~----~----~------~----~------~--~---
Chris McDonough
2008-09-07 02:50:02 UTC
Permalink
I checked in what I had for fixes for both of these bugs. Hopefully what I
checked in is what's intended, or at least won't break anything; all the tests pass.

- C
Post by Chris McDonough
Hi Malthe and all...
I found two niggly bugs in z3c.pt.
<a tal:attributes="href info.submit_url"/>
href = fo.submit_url
i += 2
i += 3
Which indeed solves the issue.
variable = self.symbols.slot+element.node.fill_slot
Sometimes fails because element.node.fill_slot is None. I have no idea why, but
# XXX this should not be necessary, but the above
# xpath expression finds non-fill-slot nodes somehow
continue
I'm not confident enough to check either fix in, because I don't understand what
the first is testing for, and I haven't had the time to backtrace the fill_slot
thing yet.
- C
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "z3c.pt" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to z3c_pt+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/z3c_pt?hl=en
-~----------~----~----~----~------~----~------~--~---

Loading...