This is a snippet of my code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/
kid/ns#">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type"
py:replace="''"/>
</head>
<body>
<p>Account Confirmation</p>
<p>Here is your new Member Account User ID and Password<br />
Your User Id is: ${user.user_name}
Your Password is: ${user.password}</p>
</body>
</html>
message = KIDMessage(
sender='[EMAIL PROTECTED]',
recipient=user.email_address,
subject='Account confirmation',
template='panclub.templates.email-confirm',
variables=dict(user=user))
enqueue(message)
There is no variable called format. Turbomail fail to generate the
plain text part of the mail. I don't think the problem comes from
turbomail but from turbogears. It fails when it tries to generate
plain text pages using kid templates.
With the same template the following code fails
@expose(template="panclub.templates.email-confirm", format='plain')
def foo(self):
user = User.get(1)
return dict(user=user)
And this one works fine.
@expose(template="panclub.templates.email-confirm", format='html')
def foo(self):
user = User.get(1)
return dict(user=user)
-fred-
On Aug 23, 2007, at 5:18 PM, David Stanek wrote:
> Likely you are using a variable name in your template that Kid
> depends on. From the traceback it looks like 'format' may be the
> magic variable.
>
>
> On 8/21/07, Fred C <[EMAIL PROTECTED]> wrote:
>
>
> I have a very simple template. When I render this template in html or
> xhtml everything works fine. But when I use format='plain' I get this
> following error.
>
> Am I doing something wrong or is it a problem with kid or turbogears.
> I didn't had this problem with an older versions of turbogears.
>
> Thanks
>
> -fred-
>
>
>
> File "/usr/pkg/lib/python2.5/site-packages/TurboGears-1.0.3.2-
> py2.5.egg/turbogears/controllers.py", line 86, in _process_output
> fragment=fragment)
> File "/usr/pkg/lib/python2.5/site-packages/TurboGears-1.0.3.2-
> py2.5.egg/turbogears/view/base.py", line 129, in render
> return engine.render(**kw)
> File "/usr/pkg/lib/python2.5/site-packages/TurboKid- 1.0.2-
> py2.5.egg/turbokid/kidsupport.py", line 195, in render
> output=output, format=format)
> File "/usr/pkg/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/
> __init__.py", line 301, in serialize
> raise_template_error(module=self.__module__)
> File "/usr/pkg/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/
> __init__.py", line 299, in serialize
> return serializer.serialize(self, encoding, fragment, format)
> File "/usr/pkg/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/
> serialization.py", line 107, in serialize
> text = ''.join(self.generate(stream, encoding, fragment, format))
> File "/usr/pkg/lib/python2.5/site-packages/kid- 0.9.6-py2.5.egg/
> kid/
> serialization.py", line 749, in generate
> for ev, item in self.apply_filters(stream, format):
> File "/usr/pkg/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/
> serialization.py ", line 149, in format_stream
> filter_text = format.filter
> AttributeError: 'str' object has no attribute 'filter'
> Error in code generated from template file '/Users/fred/src/web/
> panclub/panclub/templates/email- confirm.kid'
>
>
>
>
>
> --
> David
> http://www.traceback.org
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---