[Grok-dev] grokcore.view 1.9 and grokcore.formlib
Martin Aspeli
optilude+lists at gmail.com
Sat Jul 18 13:21:51 EDT 2009
Hi,
Today, I tried to make five.grok work with grokcore.view 1.9, in
particular the CodeView change. It seems silly to release five.grok 1.0
final when the grokcore.view refactoring is already done and released,
and will introduce backwards-incompatible changes for anyone who'd used
a custom render() method on a view.
The change was simple: just add a CodeView like this to component.py and
import in __init__.py:
class CodeView(grokcore.view.CodeView, Acquisition.Explicit):
getPhysicalPath = Acquisition.Acquired
Then change the ViewSecurityGrokker to use BaseView as a context instead
of View.
However, there are some problems.
1) There's a failure in READE.txt because it uses a grok.templatedir()
with path separators. Apparently, that's no longer allowed.
2) All the autofields tests fail deep inside grokcore.formlib. I think
maybe grokcore.formlib isn't meant to work with grokcore.view 1.9
Does that sound right? The errors are all like this:
File
"/Users/optilude/Development/Plone/Code/Build/dexterity/src/five.grok/src/five/grok/ftests/form/form.py",
line 29, in five.grok.ftests.form.form
Failed example:
browser.open("http://localhost/manfred")
Exception raised:
Traceback (most recent call last):
File
"/Users/optilude/.buildout/eggs/zope.testing-3.7.6-py2.4.egg/zope/testing/doctest.py",
line 1361, in __run
compileflags, 1) in test.globs
File "<doctest five.grok.ftests.form.form[line 29, example 12]>",
line 1, in ?
browser.open("http://localhost/manfred")
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/zope/testbrowser/browser.py",
line 224, in open
self.mech_browser.open(url, data)
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/mechanize/_mechanize.py",
line 177, in open
return self._mech_open(url, data)
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/mechanize/_mechanize.py",
line 202, in _mech_open
response = UserAgent.open(self, self.request, data)
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/mechanize/_opener.py",
line 234, in open
response = urlopen(self, req, data)
File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 376, in _open
'_open', req)
File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 337, in _call_chain
result = func(*args)
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/Products/Five/testbrowser.py",
line 64, in http_open
return self.do_open(PublisherConnection, req)
File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py",
line 993, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/zope/testbrowser/testing.py",
line 80, in request
self.response = self.caller(request_string, handle_errors)
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/Testing/ZopeTestCase/functional.py",
line 38, in wrapped_func
return func(*args, **kw)
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py",
line 182, in http
debug=not handle_errors,
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/ZPublisher/Test.py",
line 199, in publish_module
response = publish(request, module_name, after_list, debug=debug)
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/ZPublisher/Publish.py",
line 150, in publish
sys.exc_info()[2],
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/ZPublisher/Publish.py",
line 119, in publish
request, bind=1)
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/ZPublisher/mapply.py",
line 88, in mapply
if debug is not None: return debug(object,args,context)
File
"/Users/optilude/.buildout/zope/Zope-2.10.8-final-py2.4/lib/python/ZPublisher/Publish.py",
line 42, in call_object
result=apply(object,args) # Type s<cr> to step into published
object.
File
"/Users/optilude/.buildout/eggs/grokcore.formlib-1.1-py2.4.egg/grokcore/formlib/components.py",
line 91, in __call__
return self.render()
File
"/Users/optilude/.buildout/eggs/grokcore.formlib-1.1-py2.4.egg/grokcore/formlib/components.py",
line 74, in render
self.form_result = self._render_template()
AttributeError: _render_template
Is anyone working on fixing this in grokcore.formlib? I don't use that
package myself, so I'm less interested in trying to fix it, but I'm
quite interested in a stable five.grok release that's as future proof as
possible.
Martin
--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
More information about the Grok-dev
mailing list