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
Template file name always output file name?
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
  2 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
 
Christian Wutte  
View profile  
 More options Feb 7 2012, 5:54 pm
From: Christian Wutte <christian.wu...@gmx.at>
Date: Tue, 7 Feb 2012 14:54:38 -0800 (PST)
Local: Tues, Feb 7 2012 5:54 pm
Subject: Template file name always output file name?
Hello there,
I have another question: is it possible to set the output filename
independently from the template file?

Thank you, BR,
Christian


 
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 Bayer  
View profile  
 More options Feb 7 2012, 6:05 pm
From: Michael Bayer <mike...@zzzcomputing.com>
Date: Tue, 7 Feb 2012 18:05:04 -0500
Local: Tues, Feb 7 2012 6:05 pm
Subject: Re: [Mako] Template file name always output file name?

On Feb 7, 2012, at 5:54 PM, Christian Wutte wrote:

> Hello there,
> I have another question: is it possible to set the output filename
> independently from the template file?

sure, Template accepts a parameter module_filename that overrides the filename, and TemplateLookup accepts a parameter modulename_callable so that you can pass a function which applies a naming scheme to all templates.

def name_module(source_path, uri):
    return os.path.abspath(
                        os.path.join(
                            os.path.normpath("/var/tmp"),
                            uri + ".py"
                            )
                        )

lookup = TemplateLookup(directories="/foo/bar", modulename_callable=name_module)

docs:

http://docs.makotemplates.org/en/latest/usage.html#mako.lookup.Templa...
http://docs.makotemplates.org/en/latest/usage.html#mako.template.Temp...


 
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 »