Lukasz Szybalski wrote:
> On Tue, Jul 8, 2008 at 11:44 PM, Ian Bicking <[EMAIL PROTECTED]> wrote:
>> Lukasz Szybalski wrote:
>>>> Now as part of the paster create -t myapp , I would like to ask for
>>>> few vars like this:
>>>>
>>>> How can I ask for 1~10 urls of files.
>>> I was able to do it with a "def pre" function under the "class
>>> FrameworkTemplate"
>>>
>>> http://lucasmanual.com/mywiki/Paste#head-fb94caba6fe96594cfdbe779e69cd7f8514a6444
>>>
>>> So now I have a list of my urls that I need to process now.
>>>
>>> vars['myurl'] is a list of urls.
>>>
>>> 1. Where do I work with 'vars'? Do I still do it in __init__.py under
>>> "class FrameworkTemplate(templates.Template)" or?
>> Yes.  You can modify them in pre as well.
>>
>>> 2. How do I create custom files based on url? So if somebody passed in
>>> a .txt I create a txt file based on txt template. If somebody gave me
>>> a csv file I create a file based on csv template.
>>>
>>>
>>> For #2 I guess I will be using "create_template(template, output_dir,
>>> vars)", and my filenames will be called :
>>> +var_name+.txt_tmpl
>>> +var_name+.csv_tmpl
>> I'd put them all in,
> 
> Ok. So you say I should have "template/+package+/files/" plus the 2
> files in it( +var_name+.txt_tmpl ,  +var_name+.csv_tmpl )

Yes

>> then do skip_template() for the ones you don't want to
>> render, e.g., if you are using tempita, in the csv file:
>>
>> {{py:
>> if generate_file == 'txt':
>>    raise SkipTemplate
>> }}
>>
> 
> What would be the code for cheetah?
> {{
> if not 'txt' in vars['myurl']:
>     raise SkipTemplate
> }}

I can't remember exactly...?

#if not 'txt' in vars['myurl']
#  exec raise SkipTemplate

probably not, but I can't remember Cheetah well anymore.


-- 
Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org

_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users

Reply via email to