thanks for your time Massimo.
On May 28, 2:42 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I see the problem. There is something missing in my example. I will
> fix this and resend it tomorrow.
>
> Massimo
>
> On May 28, 5:18 am, Carl <carl.ro...@gmail.com> wrote:
>
>
>
> > small typo: I'm calling app/default/example rather than app/example
>
> > On May 28, 11:17 am, Carl <carl.ro...@gmail.com> wrote:
>
> > > thanks, that's very good of you.
>
> > > I've implemented a zero-fat implementation to reproduce the behaviour
> > > and remove my app's details...
>
> > > In controllers\default.py I have:
>
> > > def example():
> > > path=os.path.join(request.folder, 'views')
> > > context= dict(one="1", two="2")
> > > message= parse_template('default/
> > > example.html',path=path,context=context)
> > > print message
> > > return True
>
> > > In views\example.html I have 7 lines:
> > > An example view for emails.
>
> > > One = {{=one}}
>
> > > Two = {{two}}
>
> > > The end.
>
> > > so I call app/example
> > > and in my console I see this (from the print message statement):
> > > response.write('An example view for emails.\r\n\r\nOne =
> > > ',escape=False)
> > > response.write(one)
> > > response.write('\r\n\r\nTwo = ',escape=False)
> > > two
> > > response.write('\r\n\r\nThe end.',escape=False)
>
> > > I'm running on WinXP but I don't think that's relevant here.
>
> > > Hopefully you can either see the issue in my code or at least
> > > reproduce the behaviour using the code supplied.
>
> > > Carl
>
> > > On May 28, 12:42 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > can you post an example? I am confused.
>
> > > > On May 27, 5:15 pm, Carl <carl.ro...@gmail.com> wrote:
>
> > > > > it's got me puzzled too.
>
> > > > > the text I have in my view is used but it's prefixed response.write(
> > > > > and carriage returns are converted to \r\n
>
> > > > > a dict in my view is displayed in emails as
> > > > > response.write(absurl)
>
> > > > > C
>
> > > > > mdipierro wrote:
> > > > > > ?
>
> > > > > > why response.write( ... escape=False) ?
>
> > > > > > On May 27, 12:13 pm, Carl <carl.ro...@gmail.com> wrote:
> > > > > > > I've implemented the code but am one step away from a working
> > > > > > > solution.
>
> > > > > > > The variable message contains text "response.write( ...
> > > > > > > escape=False)"
> > > > > > > for each section of text and for each dictionary item I use in my
> > > > > > > view.
>
> > > > > > > any thoughts?
>
> > > > > > > C
>
> > > > > > > On May 27, 12:16 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > > > > You can use the web2py template language to generate emails.
>
> > > > > > > > from gluon.template import parse_template
> > > > > > > > from gluon.tool import Mail
>
> > > > > > > > mail=Mail
> > > > > > > > mail.settings.server='smtp.gmail.com:
> > > > > > > > 587'
> > > > > > > > mail.settings.sender='....@somewhere.com'
> > > > > > > > mail.settings.login=None or
> > > > > > > > 'username:password'
>
> > > > > > > > path=os.path.join(request.folder,"views")
> > > > > > > > context=dict(a=1,b=2,c=3,etc="etc")
> > > > > > > > message=parse_template('file.html',path=path,context=context)
> > > > > > > > mail.send(to=['....@whatever.com'],subject='None',message=message)
>
> > > > > > > > Massimo
>
> > > > > > > > On May 27, 4:28 am, Carl <carl.ro...@gmail.com> wrote:
>
> > > > > > > > > web2py's templating for HTML pages makes managing page
> > > > > > > > > structure
> > > > > > > > > populated with dynamic content very straightforward and
> > > > > > > > > scalable.
>
> > > > > > > > > What approach is recommended to use this power to manage
> > > > > > > > > emails/email
> > > > > > > > > templates?
>
> > > > > > > > > My application sends out emails populated with a lot of
> > > > > > > > > dynamic data
> > > > > > > > > and before I compose a String for the body text in Python I
> > > > > > > > > wondered
> > > > > > > > > if the existing template engine could be harnessed (and if
> > > > > > > > > so, what's
> > > > > > > > > the recommended way to leverage it)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to
web2py+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---