I went in and edited/commented the source at line 232 in mako/template.py
I am sure there is a reason they did this, but for me it works.


        u_norm = self.uri
        if u_norm.startswith("/"):
            u_norm = u_norm[1:]
        u_norm = os.path.normpath(u_norm)
        #~ if u_norm.startswith(".."):
            #~ raise exceptions.TemplateLookupException(
                    #~ "Template uri \"%s\" is invalid - "
                    #~ "it cannot be relative outside "
                    #~ "of the root path." % self.uri)



On Thursday, December 4, 2008 8:12:24 AM UTC-8, Jules Stevenson wrote:
>
> <<apologies for the repost, accidentally omitted a subject line 
> previously>>
>
> Hi All, I'm building an intranet based office management 'thing'. It has a
> lot to do with automating project setup, folder creation, various start up
> scripts etc. One snag that I've hit is I seem unable to access mako 
> template
> files that are outside of the pylons project. 
>
> For example
>
> <% 
>     path=os.path.join(g.work_path, c.shotOb.project.client.client,
> c.shotOb.project.name, '_ark','utils.mako')
>     shot_spec_utils = local.get_namespace(path) %>
>
> Results in:
>
> <class 'mako.exceptions.TemplateLookupException'>: Cant locate template for
> uri '//jules-pc/work_temp\client\project\_ark\utils.mako
>
> Which as a path is correct. I'm guessing it doesn't work because it's 
> trying
> to find the path from within the templates folders of the pylons project,
> for example, changing path to 'path='/clients/client.mako' [which is inside
> the templates folder] is fine - is there any way to make mako understand an
> 'absolute' path?
>
> I'm trying to do this as each project is likely to have its own set of
> specific pages, and It makes a lot of sense to be able to tie these pages 
> in
> with the on disk file structure of the project [which is outside of the
> pylons project, and certainly doesn't want to be inside the templates 
> folder
> of the pylons app :)]. If anyone has any alternative ideas for this, I'd be
> well up for hearing them.
>
> Many thanks,
>
> Jules
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/5Yu-0OpIV9gJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to