[Zope3-dev] Re: [Zope3-checkins] CVS: Zope3/src/zope/publisher - browser.py:1.7

Jim Fulton jim@zope.com
Thu, 13 Feb 2003 07:16:56 -0500


Marius Gedminas wrote:
> On Thu, Feb 13, 2003 at 09:32:45AM +0200, Tres Seaver wrote:
> 
>>=== Zope3/src/zope/publisher/browser.py 1.6 => 1.7 ===
>>--- Zope3/src/zope/publisher/browser.py:1.6	Tue Feb 11 11:00:08 2003
>>+++ Zope3/src/zope/publisher/browser.py	Thu Feb 13 00:06:24 2003
>>@@ -19,7 +19,9 @@
>> import re
>> from types import ListType, TupleType, StringType, StringTypes
>> from cgi import FieldStorage, escape
>>+from datetime import datetime
>>
>>+from zope.app.datetimeutils import parse as parseDateTime
>> from zope.i18n.interfaces import IUserPreferredLanguages
>> from zope.i18n.interfaces import IUserPreferredCharsets
>> from zope.publisher.interfaces.browser import IBrowserPresentation
> 
> 
> I thought modules outside zope.app weren't supposed to import anything
> from zope.app. 

That's right.

 > This import creates a dependency loop and breaks unit
> tests for our Zope3 product:
> 
>   >>> import zope.publisher.browser
>   Traceback (most recent call last):
>     File "<stdin>", line 1, in ?
>     File "/home/users/mg/Zope3/src/zope/publisher/browser.py", line 24, in ?
>       from zope.app.datetimeutils import parse as parseDateTime
>     File "/home/users/mg/Zope3/src/zope/app/__init__.py", line 18, in ?
>       from _app import config, Application
>     File "/home/users/mg/Zope3/src/zope/app/_app.py", line 22, in ?
>       from zope.publisher.browser import TestRequest
>   ImportError: cannot import name TestRequest
> 
> I think zope.app.datetimeutils should be moved to zope.datetimeutils.

I think that's reasonable. Another option would be to make the publisher
marshaling facility pluggable, so that zope.app could plug in a specialized
date-time parser.

Jim

-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org