On Wed, Jul 9, 2008 at 10:14 AM, Ian Bicking <[EMAIL PROTECTED]> wrote: > 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
One more question on +var_name+: - Do I actually call the file "+var_name+.txt_tmpl" ? Which variable is it going to use? (there were license, description, myurl.....many more)? - Or do I call it +myurl+.txt_tmpl . If this is the case since "var[myurl] is a list how is it going to loop through the vars['myurl'] ? Example of my vars['myurl'] vars['myurl'] = [ 'myfile.txt','myfile.csv', 'myfile3.txt'] Lucas _______________________________________________ Paste-users mailing list [email protected] http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users
