Re: [Zope] Py-Toc and zope products

2005-06-10 Thread Dieter Maurer
Ed Colmar wrote at 2005-6-9 11:36 -0700:
> ...
>on init, I get this error:
>
>*UnpickleableError*
> ...
>* Module ZODB.Connection, line 387, in commit
>  __traceback_info__:
>  (('Products.SystemofControlSite.SystemofControlSite',
>  'SystemofControlSite'), '\x00\x00\x00\x00\x00\x00\xdd1', '')
>
>UnpickleableError: Cannot pickle  objects (Also, an error 
>occurred while attempting to render the standard error message.)

You get this type of Error when you try to store something
in the ZODB which is not picklable (Python's term
for "serializable"). Of course, you can store only
serializable things in the ZODB.


-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Py-Toc and zope products

2005-06-09 Thread Ed Colmar

Greetings.

I have been messing around with the py-TOC code, and am looking forward 
to implementing it into my zope/MySQL site.


I think I am missing something about how to connect it to my zope folder 
class


My goal with this is to tie in the AIM messages in with the folder class 
I am using in zope to affect database queries.  However, I've only been 
able to successfully get it running using the "bot" and "bm" classes as 
global variables (not self.bot and self.bm) so they are now outside the 
class where I need them... 

This was my best attempt at getting them inside the zope folder class, 
but zope does not like it...  Is there a better way?


class SystemofControlSite(Folder):
   def __init__(self, id, title, content):
   self.bot = MyBot("syscontrolbot23","pass")
   self.bot._info = "www.systemofcontrol.com notification bot."
   self.bm = BotManager()
   self.bm.addBot(self.bot,"myBot") # start it up
   time.sleep(1)

on init, I get this error:

*UnpickleableError*

Sorry, a site error occurred.

Traceback (innermost last):

   * Module ZPublisher.Publish, line 150, in publish_module
   * Module Products.PlacelessTranslationService.PatchStringIO, line
 51, in new_publish
   * Module ZPublisher.Publish, line 114, in publish
   * Module Zope, line 171, in zpublisher_exception_hook
   * Module ZPublisher.Publish, line 102, in publish
   * Module Zope, line 188, in commit
   * Module ZODB.Transaction, line 222, in commit
   * Module ZODB.Transaction, line 195, in commit
   * Module ZODB.Transaction, line 256, in _commit_objects
   * Module ZODB.Connection, line 387, in commit
 __traceback_info__:
 (('Products.SystemofControlSite.SystemofControlSite',
 'SystemofControlSite'), '\x00\x00\x00\x00\x00\x00\xdd1', '')

UnpickleableError: Cannot pickle  objects (Also, an error 
occurred while attempting to render the standard error message.)


I'm assuming this is because zope is attempting to make the bot 
connection persistant...



so then I did:

bot = MyBot("syscontrolbot23","pass")
bm = BotManager()
bm.addBot(bot,"myBot") # start it up


and use global variables to control it. 
   def initbot(self):

   """ create the bot  """
   global bot
   global bm
   bm.addBot(bot,"myBot") # start it up
   time.sleep(1)
   return 1

This sucks though becasue I cannot pass a message from AIM back into my 
zope product to do something with the database...


Any ideas?  Suggestions?

Cheers!

-ed
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )