[Zope] problems using Zope & mxDateTime

Heiko Stoermer heiko.stoermer@login-solutions.de
Thu, 30 Aug 2001 17:24:38 +0200


Hi all,

I'm trying to determine whether this is a Zope problem or a bug in mxDateTime:

Whenever Zope reloads the module with my tiny and dumb ExternalMethod 
"splitDate()", which imports mxDateTime, I get the following error:

<error>
Error Type: TypeError
Error Value: copy_reg is not intended for use with classes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File /var/lib/Zope-2.4.0-linux2-x86/lib/python/DocumentTemplate/DT_Util.py,
line 204, in eval
    (Object: REQUEST.set('m',utils.splitDate(odd)))
    (Info: utils)
  File &lt;string&gt;, line 2, in f
    (Object: guarded_getattr)
  File
/var/lib/Zope-2.4.0-linux2-x86/lib/python/Products/ExternalMethod/ExternalMet
hod.py, line 229, in __call__
    (Object: splitDate)
  File
/var/lib/Zope-2.4.0-linux2-x86/lib/python/Products/ExternalMethod/ExternalMet
hod.py, line 207, in getFunction
    (Object: splitDate)
  File /var/lib/Zope-2.4.0-linux2-x86/lib/python/App/Extensions.py, line 167,
in getObject
    (Info: ('/var/lib/Zope-2.4.0-linux2-x86/Extensions/BELOG.py', 'BELOG'))
  File /var/lib/Zope-2.4.0-linux2-x86/Extensions/BELOG.py, line 7, in ?
  File /usr/lib/python2.1/site-packages/mx/DateTime/__init__.py, line 7, in ?
    (Object: _DTD)
  File /usr/lib/python2.1/site-packages/mx/DateTime/__init__.py, line 40, in
modinit
  File /usr/lib/python2.1/copy_reg.py, line 14, in pickle
    (Object: DateTime)
</error>

I'm sort of puzzled...


The part in mx/DateTime/__init__.py reads:
<code>
class modinit:
 
    ### Register the two types
    import copy_reg
    def pickle_DateTime(d):
        return _DT,(d.absdate,d.abstime)
    def pickle_DateTimeDelta(d):
        return _DTD,(d.seconds,)
    copy_reg.pickle(DateTimeType,
                    pickle_DateTime,
                    _DT)
    copy_reg.pickle(DateTimeDeltaType,
                    pickle_DateTimeDelta,
                    _DTD)
</code>


I'm using:

Zope 2.4.0 (binary release, python 2.1, linux2-x86), python 2.1.1, linux2)

Python 2.1.1 (#1, Aug 30 2001, 09:43:56) [GCC 2.95.3 20010315 (SuSE)] on 
linux2


Thanks, 
H.
-- 
Heiko Stoermer                               
Project Manager                                     Login & Solutions AG
heiko.stoermer@login-solutions.de          http://www.login-solutions.de