On 21/09/2006, at 7:23 PM, David Binger wrote:
> On Sep 20, 2006, at 11:31 PM, John Tidmarsh wrote:
>
>> Now the durus file gets written to
>> /usr/lib/python2.4/site-packages/qp/sites/$PROJECT/var. Is there a
>> way
>> to configure the location of the durus file to be a non-system dir
>> location ?
>
> I think the easiest way is to make
> /usr/lib/python2.4/site-packages/qp/sites be a symlink to
> something llike ~/myqpsites.
>
> Another way is to add a 'var_directory' item to your SitePublisher's
> configuration dictionary.
On a similar note we have a number of customer collections of qp
sites which we have set up to be in separate directories. To do this
we made an override of get_sites in a locate Site class and a change
in the qp script to use our modified Site class.
We end up with a directory structure like:
/clients/FRED
/lib
/sites
/www.site1
/www.site2
/clients/BOB
/lib
/sites
/www.bobs-great-site
/www.bobs-other-site
The changes we made to Site are:
sites_package_name = 'sites'
# COPIED FROM qp.lib.site.Site, since classmethod
def get_sites(klass):
"""() -> {name:str : site:Site}
Note that this is a method of the class.
It returns an index of all of the installed sites.
"""
sites_package= import_object(klass.sites_package_name)
sites_directory = sites_package.__path__[0]
return dict([(name, Site(name))
for name in listdir(sites_directory)
if (isdir(join(sites_directory, name))
and '.' not in name)])
get_sites = classmethod(get_sites)
This basically comes down to a way to specify a package name to use,
we hard code 'sites' in this code and massage PYTHONPATH as
appropriate which isn't really a generally useful solution but works
for us (getting the qp script to know about possible options for
'choices' while getting the package name from a command line option
is fairly round about). A clean way to specify the package name to
the qp script would be ideal.
Peter W.