And continuing this monologue :) ... the separate thread ofcourse
didnt quite work as I intended. I see now that a new connection is
created for each thread/polling I create.

This brings me back to the original question... how can I force a
query to evaluate? Or is there some alternative to solve my problem?

On Jul 7, 3:08 am, ejot <[EMAIL PROTECTED]> wrote:
> Hmm, Im guessing this might also have something to do with local() for
> threads?
>
> Made my app work by using an extra and from my point of view
> uneccesary worker thread that does the polling on the database.. .
> anyone willing to offer some insight on this? I see people are trying
> to do external (from django) applications but suggestions have been to
> do cron jobs or use views in django to trigger an eventflow. These
> things aren't always applicable tho, as in my case where i have to
> keep a connection up on IRC while polling.
>
> On Jul 6, 4:50 pm,ejot<[EMAIL PROTECTED]> wrote:
>
> > Im really banging my head against a wall trying to get my threaded
> > application to play nice with djangos ORM...
>
> > this is what my thread does for each iteration..
> >     def run(self):
> >         while self.keepRunning:
> >             print repr(Topic.objects.get(id=1).content_set.order_by("-
> > id")[0])
> >             time.sleep(5)
>
> > Now, the docs say that a query should evaluate when calling repr(),
> > but it doesnt... what i do is start up my thread and in the shell:
>
> > t = Topic.objects.get(id=1)
> > eo = EntryObject(payload="Some random text")
> > eo.save()
> > e = Entry(content_object=eo, belongs_to=t)
> > e.save()
>
> > Still, the thread reports that the last object in content_set created
> > is the one that is evaluated or printed when the thread does its first
> > iteration.... what's going on here?
>
> > What Im trying to accomplish is an application (just using Djangos
> > ORM) that polls the database for new entries created, and based on
> > that sends an message out on IRC.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to