Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Using mako.imports setting in Pyramid
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Hollister  
View profile  
 More options Oct 7 2012, 12:32 pm
From: Hollister <a.hollister.willi...@gmail.com>
Date: Sun, 7 Oct 2012 09:32:49 -0700 (PDT)
Local: Sun, Oct 7 2012 12:32 pm
Subject: Using mako.imports setting in Pyramid

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.

I'm using Pyramid 1.3 and Mako 0.7.0.

I also posted this on SO<http://stackoverflow.com/questions/12759385/pyramid-setting-mako-impo...>,
but not a peep yet.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hollister  
View profile  
 More options Oct 7 2012, 8:42 pm
From: Hollister <a.hollister.willi...@gmail.com>
Date: Sun, 7 Oct 2012 17:42:48 -0700 (PDT)
Local: Sun, Oct 7 2012 8:42 pm
Subject: Re: Using mako.imports setting in Pyramid

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:

mako.imports = import logging

with multiple imports as

mako.imports = import logging, some.other.module

*not*

mako.imports = import logging, import some.other.module

Which I didn't infer from the documentation<http://pyramid.readthedocs.org/en/latest/narr/environment.html#mako-i...> that
reads "String list of Python statements, typically individual “import”
lines" (but maybe I just didn't understand it correctly).

Thanks to Mike Bayer for pointing me in the right direction in replying to
my post on Mako.
https://groups.google.com/forum/#!topic/mako-discuss/RNUfqX12YHE


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Merickel  
View profile  
 More options Oct 7 2012, 11:29 pm
From: Michael Merickel <mmeri...@gmail.com>
Date: Sun, 7 Oct 2012 22:28:29 -0500
Local: Sun, Oct 7 2012 11:28 pm
Subject: Re: Using mako.imports setting in Pyramid
"individual import lines" is indicating support for something like

mako.imports =
    import logging
    import some.other.module

On Sun, Oct 7, 2012 at 7:42 PM, Hollister


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hollister  
View profile  
 More options Oct 8 2012, 7:39 am
From: Hollister <a.hollister.willi...@gmail.com>
Date: Mon, 8 Oct 2012 04:39:06 -0700 (PDT)
Local: Mon, Oct 8 2012 7:39 am
Subject: Re: Using mako.imports setting in Pyramid

Ah, so not a string list in the Python sense at all.
This is where a brief example would go a long way.

Thanks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »