Re: [Zope-dev] nasty persistence problem

2001-10-19 Thread Chris Withers

Michel Pelletier wrote:
> 
> Tim McLaughlin wrote:
> >
> > Thanks Chris, I'll hold on to that for a rainier day.  I just worked
> > this one out in a very roundabout way ;)
> >
> > A product had gotten copied in that moved a Product class from one
> > module to another even though everything else was the same.  It seems
> > that ZODB doesn't like that.
> 
> It sure doesn't.  When it pickles an object, it says, here's a big
> binary blob that is the state of the object.  The code for the object
> can be found in Products.MyProduct.MyModule.MyClass.  When you move the
> code, ZODB understandably barfs.

Shane's latest atch help here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/zodbex/zodbex/

- ChangeModules will let you change the module and name of persisted 
class instances.  This could be very beneficial when you have to change 
the name of a product.

cheers,

Chris

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] nasty persistence problem

2001-10-15 Thread Chris McDonough

> Tim McLaughlin wrote:
> >
> > Thanks Chris, I'll hold on to that for a rainier day.  I just worked
> > this one out in a very roundabout way ;)
> >
> > A product had gotten copied in that moved a Product class from one
> > module to another even though everything else was the same.  It seems
> > that ZODB doesn't like that.
>
> It sure doesn't.  When it pickles an object, it says, here's a big
> binary blob that is the state of the object.  The code for the object
> can be found in Products.MyProduct.MyModule.MyClass.  When you move the
> code, ZODB understandably barfs.
>
> If I remember correctly, there is a way to make an alias in an old
> location that points to a new location when you *must* move the code for
> whatever reason.  I forget how it works though...

It works by putting a tuple of tuples in your Product's __init__.py module
in a __module_aliases__ attribute at module scope.  For example,
PythonScripts have the following __module_aliases__ attribute.

  from Shared.DC import Scripts
  __module_aliases__ = (
  ('Products.PythonScripts.Script', Scripts.Script),
  ('Products.PythonScripts.Bindings', Scripts.Bindings),
  ('Products.PythonScripts.BindingsUI', Scripts.BindingsUI),)

.. this maps the module that *used* to be at Products.PythonScripts.Script
to the module that is *now* at Scripts.Script, etc.  This only works with
modules and not with classes or other types.


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] nasty persistence problem

2001-10-15 Thread Tim McLaughlin

Michel Pelletier wrote:
> 
> Tim McLaughlin wrote:
> > A product had gotten copied in that moved a Product class from one
> > module to another even though everything else was the same.  It seems
> > that ZODB doesn't like that.
> 
> It sure doesn't.  When it pickles an object, it says, here's a big
> binary blob that is the state of the object.  The code for the object
> can be found in Products.MyProduct.MyModule.MyClass.  When you move the
> code, ZODB understandably barfs.

It definitely makes sense.

But, what makes it fun is that the Product registers correctly and it's
objects are "Addable" but the existing ones are all broken.  That
initally through me for a loop, but ultimately led to the solution (with
a little thought).  ;)

Cheers,
Tim
-- 
Tim McLaughlin
iterationZERO - www.iterationzero.com
703.481.2233

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] nasty persistence problem

2001-10-15 Thread Michel Pelletier

Tim McLaughlin wrote:
> 
> Thanks Chris, I'll hold on to that for a rainier day.  I just worked
> this one out in a very roundabout way ;)
> 
> A product had gotten copied in that moved a Product class from one
> module to another even though everything else was the same.  It seems
> that ZODB doesn't like that. 

It sure doesn't.  When it pickles an object, it says, here's a big
binary blob that is the state of the object.  The code for the object
can be found in Products.MyProduct.MyModule.MyClass.  When you move the
code, ZODB understandably barfs.

If I remember correctly, there is a way to make an alias in an old
location that points to a new location when you *must* move the code for
whatever reason.  I forget how it works though...

-Michel

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] nasty persistence problem

2001-10-12 Thread Tim McLaughlin

Thanks Chris, I'll hold on to that for a rainier day.  I just worked
this one out in a very roundabout way ;)

A product had gotten copied in that moved a Product class from one
module to another even though everything else was the same.  It seems
that ZODB doesn't like that.  So, somehow, that caused all kinds of
unrelated problems.  I put the product back to the way it was, deleted
acl_users through python, restarted, went in and undid the Global
Registry Rebuild and the delete and voila!  It works again.

Thanks,
Tim

Chris McDonough wrote:
> 
> do this in the debugger:
> 
> import Zope
> app = Zope.app()
> app.fixupZClassDependencies(rebuild=1)
> get_transaction().commit()
> 
> exit the debugger and restart, see what happens.
> 
> - Original Message -
> From: "Tim McLaughlin" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, October 12, 2001 10:29 AM
> Subject: [Zope-dev] nasty persistence problem
> 
> > I seem to be in a bad spot.  When I restarted Zope after modifying some
> > products, I got a "Could not load oid.." for all URLs.
> >
> > Basically, the only way I could even access anything was by doing an
> > "import Zope" in the Python interpreter and deleting acl_users which is
> > an instance of LoginManager.  And now I found out (once I was able to
> > login to ZMI) that two vital ZClasses are broken also.
> >
> > So, I'm kinda stuck.  Here's the error:
> >
> > Error Type: Could not load oid ~, pickled data in traceback info
> > may contain clues
> > Error Value: None
> >
> > Here's the traceback if it helps...
> >
> > Traceback (innermost last):
> >   File /zope/lib/python/ZPublisher/Publish.py, line 223, in
> > publish_module
> >   File /zope/lib/python/ZPublisher/Publish.py, line 187, in publish
> >   File /zope/lib/python/Zope/__init__.py, line 226, in
> > zpublisher_exception_hook
> > (Object: LockableItem)
> >   File /zope/lib/python/ZPublisher/Publish.py, line 171, in publish
> >   File /zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
> > (Object: manage_main)
> >   File /zope/lib/python/ZPublisher/Publish.py, line 112, in call_object
> > (Object: manage_main)
> >   File /zope/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in
> > __call__
> > (Object: manage_main)
> >   File /zope/lib/python/Shared/DC/Scripts/Bindings.py, line 354, in
> > _bindAndExec
> > (Object: manage_main)
> >   File /zope/lib/python/App/special_dtml.py, line 241, in _exec
> > (Object: manage_main)
> >   File /zope/lib/python/DocumentTemplate/DT_In.py, line 711, in
> > renderwob
> > (Object: objectItems)
> >   File /zope/lib/python/DocumentTemplate/DT_In.py, line 839, in
> > sort_sequence
> > (Object: objectItems)
> >   File /zope/lib/python/ZODB/Connection.py, line 544, in setstate
> >   File /zope/lib/python/ZODB/Connection.py, line 227, in
> > _persistent_load
> > (Info: ('\x00\x00\x00\x00\x00\x00\x17~',
> >
> '(cExtensionClass\nExtensionClass\nq\x01(U\x07Sectionq\x02(cZClasses.ZClass\
> nPersistentClass\nq\x03cZClasses.ObjectManager\nObjectManager\nq\x04cOFS.Sim
> pleItem\nSimpleItem\nq\x05tq\x06}q\x07(U\x04iconq\x08U1Control_Panel/Product
> s/Content/Section/ziconImageq\tU\n_p_changedq\nK\x01U\x07__doc__q\x0bU\x07Se
> ctionq\x0cU\x08positionq\rK\x00U\x14_v_manage_path_rolesq\x0eU\x0fContent/Se
> ctionq\x0fU\x06_p_oidq\x10U\x08\x00\x00\x00\x00\x00\x00\x17~q\x11U\nziconIma
> geq\x12(U\x08\x00\x00\x00\x00\x00\x00\x17\x95q\x13(U\tOFS.Imageq\x14U\x05Ima
> geq\x15ttQU\tmeta_typeq\x16U\x07Sectionq\x17U\nmeta_typesq\x18(}q\x19(U\nper
> missionq\x1aU\x0cAdd
> >
> Sectionsq\x1bU\x04nameq\x1cU\x07Sectionq\x1dU\x07productq\x1eU\x07Contentq\x
> 1fU\x06actionq
> > U)manage_addProduct/Content/Section_factoryq!u}q"(h\x1aU\x10Add
> > NewsSectionsq#h\x1cU\x0bNewsSectionq$h\x1eh\x1fh
> > U-manage_addProduct/Content/NewsSection_factoryq%u}q&(h\x1aU\tAdd
> > Pagesq\'h\x1cU\x04Pageq(h\x1eU\x07Contentq)h
> > U&manage_addProduct/Content/Page_factoryq*u}q+(U\npermissionq,U\x10Add
> >
> ItemSectionsq-U\x04nameq.U\x0bItemSectionq/U\x07productq0U\x07Contentq1U\x06
> actionq2U-manage_addProduct/Content/ItemSection_factoryq3u}q4(U\npermissionq
> 5U\x13Add
> >
> CatalogSectionsq6U\x04nameq7U\x0eCatalogSectionq8U\x07productq9U\x07Contentq
> :U\x06actionq;U0manage_addProduct/Content/CatalogSection_factoryq<u}q=(U\
> nvisibilityq>U\x06Globalq?U\ninterfacesq@]qA(cInterface.iclass\nInterface
> \nqBoqC}qD(U\x11_Interface__attrsqE}qF(U\nwl_getL

Re: [Zope-dev] nasty persistence problem

2001-10-12 Thread Chris McDonough

do this in the debugger:

import Zope
app = Zope.app()
app.fixupZClassDependencies(rebuild=1)
get_transaction().commit()

exit the debugger and restart, see what happens.


- Original Message -
From: "Tim McLaughlin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 12, 2001 10:29 AM
Subject: [Zope-dev] nasty persistence problem


> I seem to be in a bad spot.  When I restarted Zope after modifying some
> products, I got a "Could not load oid.." for all URLs.
>
> Basically, the only way I could even access anything was by doing an
> "import Zope" in the Python interpreter and deleting acl_users which is
> an instance of LoginManager.  And now I found out (once I was able to
> login to ZMI) that two vital ZClasses are broken also.
>
> So, I'm kinda stuck.  Here's the error:
>
> Error Type: Could not load oid ~, pickled data in traceback info
> may contain clues
> Error Value: None
>
> Here's the traceback if it helps...
>
> Traceback (innermost last):
>   File /zope/lib/python/ZPublisher/Publish.py, line 223, in
> publish_module
>   File /zope/lib/python/ZPublisher/Publish.py, line 187, in publish
>   File /zope/lib/python/Zope/__init__.py, line 226, in
> zpublisher_exception_hook
> (Object: LockableItem)
>   File /zope/lib/python/ZPublisher/Publish.py, line 171, in publish
>   File /zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
> (Object: manage_main)
>   File /zope/lib/python/ZPublisher/Publish.py, line 112, in call_object
> (Object: manage_main)
>   File /zope/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in
> __call__
> (Object: manage_main)
>   File /zope/lib/python/Shared/DC/Scripts/Bindings.py, line 354, in
> _bindAndExec
> (Object: manage_main)
>   File /zope/lib/python/App/special_dtml.py, line 241, in _exec
> (Object: manage_main)
>   File /zope/lib/python/DocumentTemplate/DT_In.py, line 711, in
> renderwob
> (Object: objectItems)
>   File /zope/lib/python/DocumentTemplate/DT_In.py, line 839, in
> sort_sequence
> (Object: objectItems)
>   File /zope/lib/python/ZODB/Connection.py, line 544, in setstate
>   File /zope/lib/python/ZODB/Connection.py, line 227, in
> _persistent_load
> (Info: ('\x00\x00\x00\x00\x00\x00\x17~',
>
'(cExtensionClass\nExtensionClass\nq\x01(U\x07Sectionq\x02(cZClasses.ZClass\
nPersistentClass\nq\x03cZClasses.ObjectManager\nObjectManager\nq\x04cOFS.Sim
pleItem\nSimpleItem\nq\x05tq\x06}q\x07(U\x04iconq\x08U1Control_Panel/Product
s/Content/Section/ziconImageq\tU\n_p_changedq\nK\x01U\x07__doc__q\x0bU\x07Se
ctionq\x0cU\x08positionq\rK\x00U\x14_v_manage_path_rolesq\x0eU\x0fContent/Se
ctionq\x0fU\x06_p_oidq\x10U\x08\x00\x00\x00\x00\x00\x00\x17~q\x11U\nziconIma
geq\x12(U\x08\x00\x00\x00\x00\x00\x00\x17\x95q\x13(U\tOFS.Imageq\x14U\x05Ima
geq\x15ttQU\tmeta_typeq\x16U\x07Sectionq\x17U\nmeta_typesq\x18(}q\x19(U\nper
missionq\x1aU\x0cAdd
>
Sectionsq\x1bU\x04nameq\x1cU\x07Sectionq\x1dU\x07productq\x1eU\x07Contentq\x
1fU\x06actionq
> U)manage_addProduct/Content/Section_factoryq!u}q"(h\x1aU\x10Add
> NewsSectionsq#h\x1cU\x0bNewsSectionq$h\x1eh\x1fh
> U-manage_addProduct/Content/NewsSection_factoryq%u}q&(h\x1aU\tAdd
> Pagesq\'h\x1cU\x04Pageq(h\x1eU\x07Contentq)h
> U&manage_addProduct/Content/Page_factoryq*u}q+(U\npermissionq,U\x10Add
>
ItemSectionsq-U\x04nameq.U\x0bItemSectionq/U\x07productq0U\x07Contentq1U\x06
actionq2U-manage_addProduct/Content/ItemSection_factoryq3u}q4(U\npermissionq
5U\x13Add
>
CatalogSectionsq6U\x04nameq7U\x0eCatalogSectionq8U\x07productq9U\x07Contentq
:U\x06actionq;U0manage_addProduct/Content/CatalogSection_factoryq<u}q=(U\
nvisibilityq>U\x06Globalq?U\ninterfacesq@]qA(cInterface.iclass\nInterface
\nqBoqC}qD(U\x11_Interface__attrsqE}qF(U\nwl_getLockqG(cInterface.Method\nMe
thod\nqHo}qI(U\x07__doc__qJU6
> Returns the locktoken identified by the locktokenuri
>
qKU\x08optionalqL}qMU\x08requiredqN(U\tlocktokenqOtU\x08__name__qPU\nwl_getL
ockqQU\tinterfaceqRU\x12WriteLockInterfaceqSU\x07varargsqTNU\x06kwargsqUNU\n
positionalqV(hOtubU\rwl_lockValuesqW(hHo}qX(hJU_
> Returns a sequence of locks.  if \'killinvalids\' is true,\n
> invalid locks will be
>
deletedqYhL}qZU\x0ckillinvalidsq[K\x00shN)hPU\rwl_lockValuesq\\hRhShTNhUNhV(
h[tubU\nwl_hasLockq](hHo}q^(hJUU
> Returns true if the lock identified by the token is attached\nto
> the object. q_hL}q`h[K\x00shN(U\x05tokenqa
>
> and on and on for a while.
>
> --
> Tim McLaughlin
> iterationZERO - www.iterationzero.com
> 703.481.2233
>
> ___
> Zope-Dev maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **

[Zope-dev] nasty persistence problem

2001-10-12 Thread Tim McLaughlin

I seem to be in a bad spot.  When I restarted Zope after modifying some
products, I got a "Could not load oid.." for all URLs.

Basically, the only way I could even access anything was by doing an
"import Zope" in the Python interpreter and deleting acl_users which is
an instance of LoginManager.  And now I found out (once I was able to
login to ZMI) that two vital ZClasses are broken also.

So, I'm kinda stuck.  Here's the error:

Error Type: Could not load oid ~, pickled data in traceback info
may contain clues
Error Value: None

Here's the traceback if it helps...

Traceback (innermost last):
  File /zope/lib/python/ZPublisher/Publish.py, line 223, in
publish_module
  File /zope/lib/python/ZPublisher/Publish.py, line 187, in publish
  File /zope/lib/python/Zope/__init__.py, line 226, in
zpublisher_exception_hook
(Object: LockableItem)
  File /zope/lib/python/ZPublisher/Publish.py, line 171, in publish
  File /zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
(Object: manage_main)
  File /zope/lib/python/ZPublisher/Publish.py, line 112, in call_object
(Object: manage_main)
  File /zope/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in
__call__
(Object: manage_main)
  File /zope/lib/python/Shared/DC/Scripts/Bindings.py, line 354, in
_bindAndExec
(Object: manage_main)
  File /zope/lib/python/App/special_dtml.py, line 241, in _exec
(Object: manage_main)
  File /zope/lib/python/DocumentTemplate/DT_In.py, line 711, in
renderwob
(Object: objectItems)
  File /zope/lib/python/DocumentTemplate/DT_In.py, line 839, in
sort_sequence
(Object: objectItems)
  File /zope/lib/python/ZODB/Connection.py, line 544, in setstate
  File /zope/lib/python/ZODB/Connection.py, line 227, in
_persistent_load
(Info: ('\x00\x00\x00\x00\x00\x00\x17~',
'(cExtensionClass\nExtensionClass\nq\x01(U\x07Sectionq\x02(cZClasses.ZClass\nPersistentClass\nq\x03cZClasses.ObjectManager\nObjectManager\nq\x04cOFS.SimpleItem\nSimpleItem\nq\x05tq\x06}q\x07(U\x04iconq\x08U1Control_Panel/Products/Content/Section/ziconImageq\tU\n_p_changedq\nK\x01U\x07__doc__q\x0bU\x07Sectionq\x0cU\x08positionq\rK\x00U\x14_v_manage_path_rolesq\x0eU\x0fContent/Sectionq\x0fU\x06_p_oidq\x10U\x08\x00\x00\x00\x00\x00\x00\x17~q\x11U\nziconImageq\x12(U\x08\x00\x00\x00\x00\x00\x00\x17\x95q\x13(U\tOFS.Imageq\x14U\x05Imageq\x15ttQU\tmeta_typeq\x16U\x07Sectionq\x17U\nmeta_typesq\x18(}q\x19(U\npermissionq\x1aU\x0cAdd
Sectionsq\x1bU\x04nameq\x1cU\x07Sectionq\x1dU\x07productq\x1eU\x07Contentq\x1fU\x06actionq
U)manage_addProduct/Content/Section_factoryq!u}q"(h\x1aU\x10Add
NewsSectionsq#h\x1cU\x0bNewsSectionq$h\x1eh\x1fh
U-manage_addProduct/Content/NewsSection_factoryq%u}q&(h\x1aU\tAdd
Pagesq\'h\x1cU\x04Pageq(h\x1eU\x07Contentq)h
U&manage_addProduct/Content/Page_factoryq*u}q+(U\npermissionq,U\x10Add
ItemSectionsq-U\x04nameq.U\x0bItemSectionq/U\x07productq0U\x07Contentq1U\x06actionq2U-manage_addProduct/Content/ItemSection_factoryq3u}q4(U\npermissionq5U\x13Add
CatalogSectionsq6U\x04nameq7U\x0eCatalogSectionq8U\x07productq9U\x07Contentq:U\x06actionq;U0manage_addProduct/Content/CatalogSection_factoryqU\x06Globalq?U\ninterfacesq@]qA(cInterface.iclass\nInterface\nqBoqC}qD(U\x11_Interface__attrsqE}qF(U\nwl_getLockqG(cInterface.Method\nMethod\nqHo}qI(U\x07__doc__qJU6
Returns the locktoken identified by the locktokenuri
qKU\x08optionalqL}qMU\x08requiredqN(U\tlocktokenqOtU\x08__name__qPU\nwl_getLockqQU\tinterfaceqRU\x12WriteLockInterfaceqSU\x07varargsqTNU\x06kwargsqUNU\npositionalqV(hOtubU\rwl_lockValuesqW(hHo}qX(hJU_
Returns a sequence of locks.  if \'killinvalids\' is true,\n   
invalid locks will be
deletedqYhL}qZU\x0ckillinvalidsq[K\x00shN)hPU\rwl_lockValuesq\\hRhShTNhUNhV(h[tubU\nwl_hasLockq](hHo}q^(hJUU
Returns true if the lock identified by the token is attached\nto
the object. q_hL}q`h[K\x00shN(U\x05tokenqa

and on and on for a while.

-- 
Tim McLaughlin
iterationZERO - www.iterationzero.com
703.481.2233

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )