You can see why here; basically I have the mako interpreter tell mako where to find templates by having the current directory (.) in the TemplateLookup. This fails if you build the site if you're not in the site directory with something like
mako.exceptions.TemplateLookupException: Cant locate template for uri u'/_templates/site.mako'
This is also why cytoplasm serve -r is temporarily broken: it chdirs to the build directory and then builds the site given the absolute path because of how the SimpleHTTPServer works.
This is slightly complicated to fix because the configuration file doesn't get the Site object, so it can't look up the full source directory.
There are a couple ways I could fix this:
pass the Site to each interpreter, which breaks compatibility with old interpreters; people would have to change their configurations. It would also muddle the neat separation of concerns I have going on now, so I'd rather not.
fix the cytoplasm serve -r so it doesn't use SimpleHTTPServer and need to chdir; at best this is a workaround and doesn't fix the underlying problem. (I probably shouldn't be using SimpleHTTPServer anyway but it's standardlib and it works mostly)
fix the way configuration files work; don't have the defaults at module-level but have a class instead; the class would do some magic in order to import and run the user's configuration file. This would probably require some eval or exec ugliness.
You can see why here; basically I have the mako interpreter tell mako where to find templates by having the current directory (
.
) in the TemplateLookup. This fails if you build the site if you're not in the site directory with something likeThis is also why
cytoplasm serve -r
is temporarily broken: it chdirs to the build directory and then builds the site given the absolute path because of how the SimpleHTTPServer works.This is slightly complicated to fix because the configuration file doesn't get the Site object, so it can't look up the full source directory.
There are a couple ways I could fix this:
cytoplasm serve -r
so it doesn't use SimpleHTTPServer and need to chdir; at best this is a workaround and doesn't fix the underlying problem. (I probably shouldn't be using SimpleHTTPServer anyway but it's standardlib and it works mostly)eval
orexec
ugliness.Any other ideas?