[Zope3-dev] Package organization quandry

Shane Hathaway shane@zope.com
Fri, 17 May 2002 10:20:41 -0400


Jim Fulton wrote:
> Shane Hathaway wrote:
>>Here's an idea: we could put all the "dead chickens" in a single
>>package, called Zope.App.Altar^H^H^H^H^HCommon.  It would consist of
>>short scripts that connect multiple libraries together.  We could say
>>that the scripts must be quite short (2 or 3 lines) because the scripts
>>are meant to be copied and pasted if anyone wants to use the same
>>functionality outside Zope.App.
> 
> 
> Could you give an example?

from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
from Zope.Security.TALES import restricted_TALES_engine

def ZPTFile(filename, prefix=None):
   return PageTemplateFile(filename, prefix, restricted_TALES_engine)


So code that depends on Zope.App would get to use the ZPTFile() 
function, while code that doesn't depend on Zope.App has to import both 
PageTemplateFile and the restricted TALES engine.

It seems like there are several places where logically independent 
libraries intersect, like PageTemplates/Security and 
Zope.Server/Zope.Publisher.  You'd want them to stay distinct, but 
somewhere there has to be code that does the minimal work of joining 
them together.  You wouldn't really want to create a package just for 
the intersection, since the package would consist of only a few lines of 
code and the right name is elusive (Zope.PublisherAndServer?  Yikes.) 
So it seems attractive to have a place like Zope.App.Common where these 
bits of code for joining libraries can go, and if people want to reuse 
the bits of code outside Zope.App, they can safely copy and paste since 
the join code is absolutely minimal.

Shane