Lukasz Szybalski wrote:
> Which Template() is it? I get the following error?
> 
>>>>>   from paste.script.templates import Template
>>>>> for filename in vars['myurl']:
>>>>>  if txt in filename:
>>>>>    source_filename = os.path.join(os.path.dirname(__file__), 
>>>>> 'my_templates/text.txt_tmpl')
>>>>>    content = Template(filename=source_filename).substitute(**vars)
>>>>>    self.ensure_file(filename, content)
> 
> File "/home/lucas/tmp/myapp/myapp/__init__.py", line 43, in post
>     content = Template(filename=source_filename).substitute(**vars)
> TypeError: __init__() got an unexpected keyword argument 'filename'

Like I said, I don't remember how to instantiate Cheetah templates.

> 
> 
> Question 2 In details:
> 
> source_filename = os.path.join(os.path.dirname(__file__),
> 'my_templates/text.txt_tmpl')
> Above  tells where my template file is correct?

Yes.

> 
>>>>>   content = Template(filename=source_filename).substitute(**vars)
> This fills in my cheetah template. If I pass a dictionary **vars how
> do I reference my list of variables? It seems to me I should be
> passing  .substitute(**vars,filename). Can I do that?

Er... I don't really understand.  It depends on how Cheetah works, I 
don't remember.

>>>>>   self.ensure_file(filename, content)
> Filename above should be '+package+/myfile.txt' or
> '+package+/DB/myfile.txt'  if I want it to appear in under +package+
> folder or  under DB folder inside the +package+?? or?

The filename should be the actual filename you want to write, no +var+ 
substitutions.  So maybe os.path.join(vars['package'], 'myfile.txt').

-- 
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