Closed me-kell closed 7 months ago
-1 this would result in non-moveable projects. I tend to skip this here and go for generating all this with the other cookiecutter-zope-instance while running make
this would result in non-moveable projects
I'm not sure I understand. Which part do you mean? The CHAMELEON_CACHE
part or the replacing of your ABSPATH
by the abspath
filter?
The proposed extraction of CHAMELEON_CACHE
from <environment>
is of course opinionated. But on the other side I cannot imagine how to generate a project with a directory structure like the one described above (e.g. in a parts directory) and call runwsgi
from another directory.
Regarding the absolute paths: AFAICS the projects generated are already "not-moveable". Or do I get something wrong? There are already a couple of ABSPATH
(see etc/zope.conf). Here I simple replace your ABSPATH
by an abspath
filter which do exactly the same and takes into account OS specifics (e.g. slashes).
The intention behind was simply to offer some help after reading the comment on hooks/post_gen_project.py#L1f:
# post generation step 1: replace relative with absolute path # theres no way to get this path while generating the files
You are right. But: All this features are dup here, already covered in the other cookie cutter. I tend to start working on moving in the right direction instead of adding duct tape here.
Now I'm really confused.
Which other cookie cutter do you mean? I'm here in the "wrong movie"?
yes, I am confused and been in the wrong movie. Sorry. m( Go on, nothing to see.
ok, all fine, I need more coffee in the morning.
When creating a structure like the following (see below) we must run
cookiecutter-zope-instance
in theparts
directory. Having previously runmkzeoinstance
from${PLONE_HOME}
which creates theparts
directory.Some paths (
CHAMELEON_CACHE
,args
in the sectionshandler_accesslog
andhandler_eventlog
) are generated relative to the directorycookiecutter-zope-instance
was called from from.Starting
runwsgi
with the generated${PLONE_HOME}/parts/client/etc/zope.ini
from another directory thanparts
will not work.I'd like to propose the following two steps as a solution:
ABSPATH()
toargs
in the sectionshandler_accesslog
andhandler_eventlog
:ABSPATH()
toCHAMELEON_CACHE
.This is not trivial since the template zope.conf assumes a dictionary and is not aware of its items types.
On the other side, adding
ABSPATH()
toCHAMELEON_CACHE
incookiecutter.json
is not a solution because this variable is used inpost generation step 3: generate directories
inpost_gen_project.py
.post generation step 3
also assumes thatcookiecutter.environment['CHAMELEON_CACHE']
exists to generate the cache's directory.One could then remove this variable from the
environment
dictionary incookiecutter.json
and adding theCHAMELEON_CACHE
as extra variable. This way the variable could be inserted in the template withABSPATH
. The conditionalif cookiecutter.environmentt
would be redundant.This way we could start
runwsgi
from any directory.