[Catalyst] Suggestions for sending email from cron jobusing'Catalyst' templates?

Octavian Rasnita orasnita at gmail.com
Tue Apr 12 05:53:03 GMT 2011


From: Peter Edwards =

  On 12 April 2011 00:50, Charlie Garrison <garrison at zeta.org.au> wrote:

    Good morning,

    On 11/04/11 at 6:58 PM +0300, Octavian Rasnita <orasnita at gmail.com> wro=
te:


      The TT templates used by the Catalyst app might contain many things
      like c.user, c.uri_for_action, may display images, may depend on other
      templates which are loaded automaticly when those templates are
      specified in the app config file. So there is no sane way of using
      those wrapper templates for sending email from a cron job.


    That was the conclusion I was reaching; I wanted feedback from others b=
efore I tried to make my own garden path.


  Put the logic in a model class that reads a config shared with but indepe=
ndent from your controller so you can run it outside of Catalyst.
  This article outlines how to do this http://www.catalystframework.org/cal=
endar/2007/14

  At the top of that article appears:

  "UPDATE: As of 2008, there is a new module which avoids the "kludgy" solu=
tion mentioned below: Config::JFDI."

  At a certain moment, Config::JFDI started to support "__path_to()".

  The problem is not the model only, but the templates that use the Catalys=
t context in them.

  As it is not very recommended to access the entire Catalyst context in a =
model, it should be not recommended to use the context in the templates, be=
cause those templates won't be usable in external applications without load=
ing the entire Cat app, but because using the Catalyst context in the templ=
ates is very handy, most of us probably prefer to create separate templates=
 for using them in external apps than to provide only sane variables to all=
 the templates.

  Octavian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110412/2ed56=
bda/attachment.htm


More information about the Catalyst mailing list