i'm not sure what mako.imports is, that sounds like part of the Pyramid integration, so you'd want to check that as far as setting the config like this.
For sanity, here's how it looks in pure Mako libs:
>>> from mako.lookup import TemplateLookup
>>> l = TemplateLookup(imports=["import logging"])
>>> l.put_string("some template", "hello world")
>>> print l.get_template("some template").code
> I'd like to use mako.imports = 'import logging' in the .ini file to replace
> <%!
> import logging
> %>
> In each template, but it does not work. The template just throws NameError: name 'logging' is not defined when I attempt to use it.
> It appears the mako.imports doesn't even get called, since a setting like mako.imports = 'import SpamAndEggs' doesn't throw an error.
> This is probably a Pyramid issue, but I thought I'd see if anybody here. has an idea. I'm using Pyramid 1.3 and Mako 0.7.0.
> I also posted this on SO, but not a peep yet.
> -- > You received this message because you are subscribed to the Google Groups "Mako Templates for Python" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/mako-discuss/-/LOip4Vchf1QJ.
> To post to this group, send email to mako-discuss@googlegroups.com.
> To unsubscribe from this group, send email to mako-discuss+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mako-discuss?hl=en.
Ok, so looking at the Pyramid-generated Mako template code, it just literally outputs what's in that config setting, quotes, brackets and all.
So, the syntax has to be:
On Sunday, October 7, 2012 6:34:46 PM UTC-4, Michael Bayer wrote:
> i'm not sure what mako.imports is, that sounds like part of the Pyramid > integration, so you'd want to check that as far as setting the config like > this.
> For sanity, here's how it looks in pure Mako libs:
> -- > You received this message because you are subscribed to the Google Groups > "Mako Templates for Python" group.
> To view this discussion on the web visit > https://groups.google.com/d/msg/mako-discuss/-/LOip4Vchf1QJ.
> To post to this group, send email to mako-d...@googlegroups.com<javascript:>
> .
> To unsubscribe from this group, send email to > mako-discuss...@googlegroups.com <javascript:>.
> For more options, visit this group at > http://groups.google.com/group/mako-discuss?hl=en.
> Ok, so looking at the Pyramid-generated Mako template code, it just literally outputs what's in that config setting, quotes, brackets and all.
> So, the syntax has to be:
> Which I didn't infer from the documentation that reads "String list of Python statements, typically individual “import” lines" (but maybe I just didn't understand it correctly).
> Anyway, many thanks for helping figure this one out, Mike!
> On Sunday, October 7, 2012 6:34:46 PM UTC-4, Michael Bayer wrote:
> i'm not sure what mako.imports is, that sounds like part of the Pyramid integration, so you'd want to check that as far as setting the config like this.
> For sanity, here's how it looks in pure Mako libs:
>> I'd like to use mako.imports = 'import logging' in the .ini file to replace
>> <%!
>> import logging
>> %>
>> In each template, but it does not work. The template just throws NameError: name 'logging' is not defined when I attempt to use it.
>> It appears the mako.imports doesn't even get called, since a setting like mako.imports = 'import SpamAndEggs' doesn't throw an error.
>> This is probably a Pyramid issue, but I thought I'd see if anybody here. has an idea. I'm using Pyramid 1.3 and Mako 0.7.0.
>> I also posted this on SO, but not a peep yet.
>> -- >> You received this message because you are subscribed to the Google Groups "Mako Templates for Python" group.
>> To view this discussion on the web visit https://groups.google.com/d/msg/mako-discuss/-/LOip4Vchf1QJ.
>> To post to this group, send email to mako-d...@googlegroups.com.
>> To unsubscribe from this group, send email to mako-discuss...@googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/mako-discuss?hl=en.
> -- > You received this message because you are subscribed to the Google Groups "Mako Templates for Python" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/mako-discuss/-/elOoUhJwqaAJ.
> To post to this group, send email to mako-discuss@googlegroups.com.
> To unsubscribe from this group, send email to mako-discuss+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mako-discuss?hl=en.
> so maybe something has to happen in a pyramid config file to turn it into > a list. or maybe its just not supported.
> On Oct 7, 2012, at 8:37 PM, Hollister wrote:
> Ok, so looking at the Pyramid-generated Mako template code, it just > literally outputs what's in that config setting, quotes, brackets and all.
> So, the syntax has to be:
> Anyway, many thanks for helping figure this one out, Mike!
> On Sunday, October 7, 2012 6:34:46 PM UTC-4, Michael Bayer wrote:
>> i'm not sure what mako.imports is, that sounds like part of the Pyramid >> integration, so you'd want to check that as far as setting the config like >> this.
>> For sanity, here's how it looks in pure Mako libs:
>> -- >> You received this message because you are subscribed to the Google Groups >> "Mako Templates for Python" group.
>> To view this discussion on the web visit >> https://groups.google.com/d/msg/mako-discuss/-/LOip4Vchf1QJ.
>> To post to this group, send email to mako-d...@googlegroups.com.
>> To unsubscribe from this group, send email to >> mako-discuss...@googlegroups.com.
>> For more options, visit this group at >> http://groups.google.com/group/mako-discuss?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "Mako Templates for Python" group.
> To view this discussion on the web visit > https://groups.google.com/d/msg/mako-discuss/-/elOoUhJwqaAJ.
> To post to this group, send email to mako-d...@googlegroups.com<javascript:>
> .
> To unsubscribe from this group, send email to > mako-discuss...@googlegroups.com <javascript:>.
> For more options, visit this group at > http://groups.google.com/group/mako-discuss?hl=en.
>> so maybe something has to happen in a pyramid config file to turn it into >> a list. or maybe its just not supported.
>> On Oct 7, 2012, at 8:37 PM, Hollister wrote:
>> Ok, so looking at the Pyramid-generated Mako template code, it just >> literally outputs what's in that config setting, quotes, brackets and all.
>> So, the syntax has to be:
>> Anyway, many thanks for helping figure this one out, Mike!
>> On Sunday, October 7, 2012 6:34:46 PM UTC-4, Michael Bayer wrote:
>>> i'm not sure what mako.imports is, that sounds like part of the Pyramid >>> integration, so you'd want to check that as far as setting the config like >>> this.
>>> For sanity, here's how it looks in pure Mako libs:
>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Mako Templates for Python" group.
>>> To view this discussion on the web visit >>> https://groups.google.com/d/msg/mako-discuss/-/LOip4Vchf1QJ.
>>> To post to this group, send email to mako-d...@googlegroups.com.
>>> To unsubscribe from this group, send email to >>> mako-discuss...@googlegroups.com.
>>> For more options, visit this group at >>> http://groups.google.com/group/mako-discuss?hl=en.
>> -- >> You received this message because you are subscribed to the Google Groups >> "Mako Templates for Python" group.
>> To view this discussion on the web visit >> https://groups.google.com/d/msg/mako-discuss/-/elOoUhJwqaAJ.
>> To post to this group, send email to mako-d...@googlegroups.com.
>> To unsubscribe from this group, send email to >> mako-discuss...@googlegroups.com.
>> For more options, visit this group at >> http://groups.google.com/group/mako-discuss?hl=en.