On Sun, May 2, 2010 at 9:46 PM, Haron Media <[email protected]> wrote:
>
> What would be the recommended way to implement cron-triggered events but
> in the context and framework of a Pylons app? I suppose the most
> straightforward way would be to implement a controller and call it via
> localhost with, say, curl, minding of course all the security aspects of
> such a public handler.
>
> Is there a better way, though?
>

You can use paster request config.ini /path

See paster help request:

Usage: paster request [options] CONFIG_FILE URL [OPTIONS/ARGUMENTS]
Run a request for the described application

This command makes an artifical request to a web application that uses a
paste.deploy configuration file for the server and application.  Use 'paster
request config.ini /url' to request /url.  Use 'paster post config.ini /url <
data' to do a POST with the given request body.  If the URL is relative
(doesn't begin with /) it is interpreted as relative to /.command/.  The
variable environ['paste.command_request'] will be set to True in the request,
so your application can distinguish these calls from normal requests.  Note
that you can pass options besides the options listed here; any unknown options
will be passed to the application in environ['QUERY_STRING'].

Options:
  -h, --help            show this help message and exit
  -v, --verbose
  -q, --quiet
  -n NAME, --app-name=NAME
                        Load the named application (default main)
  --config-var=NAME:VALUE
                        Variable to make available in the config for %()s
                        substitution (you can use this option multiple times)
  --header=NAME:VALUE   Header to add to request (you can use this option
                        multiple times)
  --display-headers     Display headers before the response body


>
> Thanks,
>
>
> Vlad
>
> --
> You received this message because you are subscribed to the Google Groups 
> "pylons-discuss" 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/pylons-discuss?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.

Reply via email to