Knowledge Collector
Maurits van Rees
m.van.rees at zestsoftware.nl
Tue May 29 08:45:16 UTC 2007
Alain Hernandez Lopez, on 2007-05-29:
> from ZODB.PersistentList import PersistentList
In the ZODB package I see that PersistentList is deprecated and a
module alias is used to persistent.PersistentList. So:
1. It is better to do:
from persistent import PersistentList
2. Importing this from ZODB like you do should still work
flawlessly. :)
> from persistent import Persistent
> START_TIME1 = '2007-05-12 23:59:59.9999999'
> START_TIME2 = '2007-05-12 01:00:00.000000'
> class schedulerThread(threading.Thread,Persistent):
> ''' '''
> def __init__(self):
> """
> Class Constructor..
> """
> threading.Thread.__init__(self)
> self.__jobList = PersistentList()
Looks fine. I wonder if you should be calling the init of Persistent
as well, but probably not.
> def setJob(self, job):
> """
> Add job to the Scheduler.
> """
> self.__jobList.append(job)
> def _executeJob(self, job):
> """
> Execute Scheduler jobs.
> """
> class Child(threading.Thread):
You define a class within a method of another class? That does not
look very logical to me. I see no reason why it should fail though.
> def __init__(self):
> threading.Thread.__init__(self)
> """
> Class Constructor.
> """
> pass
As this method does not do anything other than the init of
threading.Thread itself, you can safely remove this method.
> def run(self):
> """
> Exe
> """
> job()
> c = Child()
> c.start()
> #c = childThread(job)
> #c.start()
I have not done anything with threading actually, so I will just
assume this is fine.
In other words: I made a few remarks, but they should not have
influence on the functionality. And the rest looks fine actually.
So if everything works before a restart, you may want to put a pdb in
your __init__.py and see if some code is called on startup that messes
things up.
--
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
I can assure you mine are still greater."
More information about the Product-Developers
mailing list