AW: [Checkins] SVN: z3c.zrtresource/trunk/src/z3c/zrtresource/zrtresource.pyz3c.zrtresource is made to work in Zope2. A docstring wasadded as the zope2 publisher won't publish otherwise. Added aconditional import on Five's FileResource. Only oneconditiona

Tim Terlegård tim.terlegard at valentinewebsystems.se
Fri Mar 28 11:20:23 EDT 2008


On Mar 28, 2008, at 3:53 PM, Roger Ineichen wrote:

>> Log message for revision 84995:
>>  z3c.zrtresource is made to work in Zope2. A docstring was
>> added as the zope2 publisher won't publish otherwise. Added a
>> conditional import on Five's FileResource. Only one
>> conditional import on Five was necessary - I don't think that
>> justifies a new branch so it's added to the trunk.
>>
>>
>> Changed:
>>  U   z3c.zrtresource/trunk/src/z3c/zrtresource/zrtresource.py
>>
>> -=-
>> Modified: z3c.zrtresource/trunk/src/z3c/zrtresource/zrtresource.py
>> ===================================================================
>> --- z3c.zrtresource/trunk/src/z3c/zrtresource/zrtresource.py	
>> 2008-03-28 11:36:07 UTC (rev 84994)
>> +++ z3c.zrtresource/trunk/src/z3c/zrtresource/zrtresource.py	
>> 2008-03-28 14:34:51 UTC (rev 84995)
>> @@ -18,14 +18,19 @@
>> __docformat__='restructuredtext'
>> from zope.app.component.hooks import getSite  from
>> zope.app.publisher.fileresource import File -from
>> zope.app.publisher.browser.fileresource import FileResource
>>
>> from z3c.zrtresource import processor, replace
>>
>> +try:
>> +    from Products.Five.browser.resource import FileResource
>> +except:
>> +    from zope.app.publisher.browser.fileresource import FileResource
>>
>> +
>> class ZRTFileResource(FileResource):
>>
>>     def GET(self):
>> +        """ Process original file resource and return a
>> modified one.  """
>>         data = super(ZRTFileResource, self).GET()
>>         # Process the file
>>         p = processor.ZRTProcessor(data,
>> commands={'replace': replace.Replace})
>
> This package doesn't depend on Products.Five.

I know, that's why it's a conditional import.


> Please revert this changes. That's not possible anymore with
> egg the based concept. Or at least only if you don't test
> the code.

If you use buildout or virtualenv you will never have Five in your zope3
application. I guess this can be a problem if a Five egg is installed in
the system python site-packages.


> Probably this is not much important enough for that
> *import* usecase, but if we start with that, can you tell
> me wheres the border with mixin code into Zope3 packages
> and what is Ok and where do we stop?

I agree it should rarely be used, but it was just one import so then
I thought it was ok.

I'll revert.

/Tim


More information about the Checkins mailing list