Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
TG App Bootup tasks
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ozwyzard  
View profile  
 More options Sep 14 2012, 6:03 pm
From: ozwyzard <ozwyz...@gmail.com>
Date: Fri, 14 Sep 2012 15:03:41 -0700 (PDT)
Local: Fri, Sep 14 2012 6:03 pm
Subject: TG App Bootup tasks

I have a scenario where I need to kick start app tasks (e.g. send reminded
email with URLs in it) upon re-start of a TG app.  The stale tasks need the
tg.url in the context.  I also have a "pure" tgscheduler instance that I
start when the app starts.  I cannot call the app task from the tgscheduler
instance since it chokes on (TypeError: No object (name: url) has been
registered for this thread).  Further searching tells me that request
context is not setup in my pure tgscheduler instance.

Question:  Should I schedule bootup tasks in/around make_app() ?

Thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ozwyzard  
View profile  
 More options Sep 14 2012, 7:09 pm
From: ozwyzard <ozwyz...@gmail.com>
Date: Fri, 14 Sep 2012 16:09:57 -0700 (PDT)
Local: Fri, Sep 14 2012 7:09 pm
Subject: Re: TG App Bootup tasks

More info:

I am using the following entry in app_cfg.py to invoke an init routine that
starts the tgscheduler..

# scheduler
base_config.call_on_startup = [sched_init]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alessandro Molina  
View profile  
 More options Sep 14 2012, 7:17 pm
From: Alessandro Molina <alessandro.mol...@gmail.com>
Date: Sat, 15 Sep 2012 01:17:47 +0200
Local: Fri, Sep 14 2012 7:17 pm
Subject: Re: [TurboGears] TG App Bootup tasks
As tg.url generates urls using the HTTP request that is serving to
retrieve things like the domain and where the app is mounted it is
actually not possible to call it outside a request.

You should probably write somewhere the domain which the links you are
generating should point to and make urls from that one using something
like: '?'.join((mydomain, urllib.urlencode(params))


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ozwyzard  
View profile  
 More options Sep 14 2012, 10:22 pm
From: ozwyzard <ozwyz...@gmail.com>
Date: Fri, 14 Sep 2012 19:22:44 -0700 (PDT)
Local: Fri, Sep 14 2012 10:22 pm
Subject: Re: [TurboGears] TG App Bootup tasks

Thanks.

For now, I might just reassign an existing base-url-variable in the
exception handler.

Ideally, I'd like tg.url to do the work of deducing the base_url of the
app; else I'd have to deduce it programatically by rummaging through config
vars like base_config and app_conf.  I could write the base_url in a global
variable, but if I were to use tg.url, it would require at least 1 incoming
request.  Is there a way for me to figure out the mount point without using
tg.url (e.g. poke somewhere in pylons)?

Thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Pedersen  
View profile  
 More options Sep 18 2012, 1:04 am
From: Michael Pedersen <m.peder...@icelus.org>
Date: Tue, 18 Sep 2012 01:04:34 -0400
Local: Tues, Sep 18 2012 1:04 am
Subject: Re: [TurboGears] TG App Bootup tasks

On Fri, Sep 14, 2012 at 10:22 PM, ozwyzard <ozwyz...@gmail.com> wrote:
> Ideally, I'd like tg.url to do the work of deducing the base_url of the app;
> else I'd have to deduce it programatically by rummaging through config vars
> like base_config and app_conf.  I could write the base_url in a global
> variable, but if I were to use tg.url, it would require at least 1 incoming
> request.  Is there a way for me to figure out the mount point without using
> tg.url (e.g. poke somewhere in pylons)?

Okay, I'm trying to catch up, so can't dig too deep for the full
answer to this right now. I can tell you that you're going to be
limited in your ability to do this the way you want.

If you go through WSGI, you'll find that a WSGIScriptAlias gets set
up. You can use that to get the relative path to the top of the web
server. However, that does still leave you with an open question: What
domain is being served up for this? So far as I can tell, WSGI doesn't
provide the domain, so you are not able to use any code to determine,
programmatically, the domain to use. That's only resolved by issuing a
request to that domain.

This can help, but you're still going to have to have something,
somewhere, to tell you the domain for the links to send out.

--
Michael J. Pedersen
My Online Resume: http://www.icelus.org/ -- Google+ http://plus.ly/pedersen
Google Talk: m.peder...@icelus.org -- Twitter: pedersentg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ozwyzard  
View profile  
 More options Oct 12 2012, 8:37 pm
From: ozwyzard <ozwyz...@gmail.com>
Date: Fri, 12 Oct 2012 17:37:19 -0700 (PDT)
Local: Fri, Oct 12 2012 8:37 pm
Subject: Re: [TurboGears] TG App Bootup tasks

No worries.  I dealt with the issue a while back by a try-except block that
tries to use tgurl, and falls back to either a config.get() value or a
hard-coded URL value.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »