zope.mimetype dependency on zope.publisher
All - looking for a bit of input on a dependency for zope.mimetype (zope.publisher) not advertised in setup.py for that package: zope.mimetype.typegetter imports zope.publisher.contenttype for two functions (parse() and parseOrdered()). I'm assuming this dependency is more historical than anything else, but I'm guessing out of ignorance. I'm working on a minimal-dependencies CA application (using zope.schema and zope.component only) that could likely use zope.mimetype in a context outside of a full zope 3 web publishing environment, and I was curious if this particular dependency is purposeful/desired? Thanks, Sean +----------------------------------------------------------+ Sean Upton The San Diego Union-Tribune 619.293.1451 Systems Applications Supervisor - Newsroom Information Technology 350 Camino De La Reina San Diego, CA 92108 sean.upton@uniontrib.com +----------------------------------------------------------+
On Feb 20, 2008 3:25 PM, <sean.upton@uniontrib.com> wrote:
All - looking for a bit of input on a dependency for zope.mimetype (zope.publisher) not advertised in setup.py for that package:
Sorry!
zope.mimetype.typegetter imports zope.publisher.contenttype for two functions (parse() and parseOrdered()). I'm assuming this dependency is more historical than anything else, but I'm guessing out of ignorance.
This dependency exists because the content-type parsing functions happened to be available in zope.publisher. I'd be happy to see things refactored to allow this dependency to be broken.
I'm working on a minimal-dependencies CA application (using zope.schema and zope.component only) that could likely use zope.mimetype in a context outside of a full zope 3 web publishing environment, and I was curious if this particular dependency is purposeful/desired?
The dependency exists entirely to get to those functions; there's no specific desire to create a dependency. -Fred -- Fred L. Drake, Jr. <fdrake at gmail.com> "Chaos is the score upon which reality is written." --Henry Miller
Fred Drake wrote:
This dependency exists because the content-type parsing functions happened to be available in zope.publisher. I'd be happy to see things refactored to allow this dependency to be broken.
Do I remember rightly that there's a zope.contenttype these could be moved to? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
On Thu, Feb 21, 2008 at 9:31 AM, Chris Withers <chris@simplistix.co.uk> wrote:
Do I remember rightly that there's a zope.contenttype these could be moved to?
You do, though I didn't. :-) zope.contenttype is a copy/hack of an older version of the mimetypes module from Python's standard library. I'm not sure it's a *good* place to put the functions, but it's probably better than zope.publisher. zope.publisher.contenttype would need to remain for compatibility, but should be able to simply import the functions from zope.contenttype. I'll suggest the just copying the implementation module to zope.contenttype.parser. :-) There are tests that will need to be copied as well. -Fred -- Fred L. Drake, Jr. <fdrake at gmail.com> "Chaos is the score upon which reality is written." --Henry Miller
Fred Drake wrote:
zope.contenttype is a copy/hack of an older version of the mimetypes module from Python's standard library. I'm not sure it's a *good* place to put the functions, but it's probably better than zope.publisher.
zope.contenttype has only standard library dependencies, which is an improvement for me. This functionality is thematically related, if nothing else.
zope.publisher.contenttype would need to remain for compatibility, but
should be able to simply import the functions from zope.contenttype.
I experimented (diff attached) by moving contenttype.py to zope.contenttype.mimeparser, then copying tests; with minor search/replace in the copy of tests, this works. If these can be moved, it seems much better to make zope.contenttype a documented dependency of zope.mimetype and change the imports in zope.mimetype to cease importing from zope.publisher.
I'll suggest the just copying the implementation module to zope.contenttype.parser. :-) There are tests that will need to be copied as well.
Renaming that module to be more descriptive too might be good when it is copied. See attached diff to trunk r79689 (for which tests pass) for what I'm thinking. Thanks, Sean +----------------------------------------------------------+ Sean Upton The San Diego Union-Tribune 619.293.1451 Systems Applications Supervisor - Newsroom Information Technology 350 Camino De La Reina San Diego, CA 92108 sean.upton@uniontrib.com +----------------------------------------------------------+
On Thu, Feb 21, 2008 at 3:10 PM, <sean.upton@uniontrib.com> wrote:
zope.contenttype has only standard library dependencies, which is an improvement for me.
For everyone, really.
Renaming that module to be more descriptive too might be good when it is copied. See attached diff to trunk r79689 (for which tests pass) for what I'm thinking.
+1 You're a committer, right? :-) -Fred -- Fred L. Drake, Jr. <fdrake at gmail.com> "Chaos is the score upon which reality is written." --Henry Miller
participants (3)
-
Chris Withers -
Fred Drake -
sean.upton@uniontrib.com