Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Make zope.app.publication dependency optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Sutherland committed Jan 23, 2013
1 parent 31e46b4 commit 1fa73f8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CHANGES
1.3.5 (unreleased)
------------------

- Nothing changed yet.
- Make zope.app.publication dependency optional.


1.3.4 (2012-01-20)
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def read(*rnames):
'zope.testing',
]),
install_requires=['setuptools',
'zope.app.publication',
'zope.browserpage',
'zope.browserresource',
'zope.component',
Expand Down
1 change: 1 addition & 0 deletions src/zc/resourcelibrary/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/>

<utility
zcml:condition="installed zope.app.publication"
component=".publication.Request"
provides="zope.app.publication.interfaces.IBrowserRequestFactory"
/>
Expand Down
8 changes: 6 additions & 2 deletions src/zc/resourcelibrary/publication.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
$Id: publication.py 4528 2005-12-23 02:45:25Z gary $
"""
from zope import interface
from zope.app.publication.interfaces import IBrowserRequestFactory
from zope.component import queryMultiAdapter, getMultiAdapter
from zope.publisher.browser import BrowserRequest, BrowserResponse
from zope.publisher.browser import isHTML
Expand All @@ -25,6 +24,11 @@
import zc.resourcelibrary
import zope.component.hooks

try:
from zope.app.publication.interfaces import IBrowserRequestFactory
except:
class IBrowserRequestFactory(interface.Interface):
pass

class Request(BrowserRequest):
interface.classProvides(IBrowserRequestFactory)
Expand Down Expand Up @@ -97,7 +101,7 @@ def retry(self):
def _implicitResult(self, body):
#figure out the content type
content_type = self.getHeader('content-type')
if content_type is None:
if content_type is None and self._status != 304:
if isHTML(body):
content_type = 'text/html'
else:
Expand Down

0 comments on commit 1fa73f8

Please sign in to comment.