On Fri, Jul 11, 2008 at 2:18 PM, Ian Bicking <[EMAIL PROTECTED]> wrote:
> 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.
>
from Cheetah.Template import Template
content = Template(file=source_filename,searchList=[vars])
>>
>>>>>> self.ensure_file(filename, content)
But I guess this self.ensure_file should be
command.ensure_file in post command.
def post(self, command, output_dir, vars):
....
command.ensure_file(filename, content)
but I get this error:
File "/var/lib/python-support/python2.5/paste/script/create_distro.py",
line 125, in command
template, output_dir, vars)
File "/var/lib/python-support/python2.5/paste/script/create_distro.py",
line 167, in create_template
template.run(self, output_dir, vars)
File "/var/lib/python-support/python2.5/paste/script/templates.py",
line 58, in run
self.post(command, output_dir, vars)
File "/home/lucas/tmp/myapp/myapp/__init__.py", line 46, in post
command.ensure_file(filename, content)
File "/var/lib/python-support/python2.5/paste/script/command.py",
line 438, in ensure_file
content.splitlines(),
AttributeError: '_home_lucas_tmp_myapp_myapp_myapp_temp' object has no
attribute 'splitlines'
Any idea why?
Lucas
_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users