On Oct 5, 2005, at 1:12 PM, Matthew Russell wrote:


I'm following Benji's quick_start.txt
TypeError: ('Could not adapt', <zope.publisher.browser.BrowserRequest
instance URL=http://localhost:8080/hello/@@edit.html>, <InterfaceClass

Hi Matt. Looks like that might be an omission from the quick start, and a reasonable one at that. We (Zope 3 devs) need to have a default story for adapting request to timezone if formlib is to be part of the trunk (and it is now). Here's a workaround (sorry that it makes you maybe do more than you should have to do for a "quick start").

Make a file, maybe called adapters.py in your package, with this in it:

import pytz
from zope import interface, component
from zope.interface.common.idatetime import ITZInfo
from zope.publisher.interfaces.browser import IBrowserRequest

def tzinfo(request):
    return pytz.timezone('US/Eastern') # or whatever timezone you wish

I dunno if Benji is having you use zcml yet. If you are, add this to your zcml:

<adapter factory=".adapters.tzinfo" />

*Otherwise* try adding this to the end of your file--


--and make sure you import the adapters file from someplace so that it will actually run.

Zope3-users mailing list

Reply via email to