[Plone-IT] Cartella senza più ID - 'NoneType' object is not callable

r.rascioni a unimc.it r.rascioni a unimc.it
Ven 4 Ago 2017 08:19:55 UTC


Ciao a tutti,

nel caso potesse essere utile a qualcuno di seguito trovate alcune righe 
di codice che ho utilizzato in debug per impostare nuovamente l'ID di 
una cartella e provvedere poi alla sua cancellazione (non era più 
possibile eliminare l'oggetto né da Plone né da ZMI)

Nel mio caso non sono riuscito a recuperare la cartella perché oltre 
all'ID mancavano parecchi degli attributi utili al funzionamento 
dell'oggetto e ho deciso così per la cancellazione.

La cartella fortunatamente era vuota ed era utile solo perché associata 
ad una vista che mi sono accorto, ahimè!, avere lo stesso ID della 
cartella!

Forse è stato proprio questo a generare l'errore, forse dopo essere 
stati eseguiti alcuni processi come ad es lo zeopack?
Nel caso aveste opinioni o idee in merito sono tutt'orecchi


import transaction

# Rename object
obj = app.site_id['folder_id']['sub_folder_id']['object_id']

oid = obj._p_oid

obj = app._p_jar[oid]
obj.setId('new_id')

transaction.commit()

# Delete object
folder = app.site_id['folder_id']['sub_folder_id']
folder._delObject('new_object_id')

transaction.commit()


Un saluto a tutti e grazie ancora ad Alessandro e Yuri per i validi 
consigli
Roberto



Il 02/08/2017 11:08, r.rascioni a unimc.it ha scritto:
> Ciao a tutti!
>
> ho fatto qualche prova come suggerito da Yuri ed Alessandro ma 
> purtroppo non sono ancora riuscito a risolvere il problema.
>
> *@Yuri*: "L'unica è determinare l'oid e con quello accedere tramite 
> zodb e correggere l'oggetto."
> In questi casi in che modo solitamente recuperi l'oid dell'oggetto?
>
> *@Alessandro: *ho provato ad utilizzare il metodo _/cleanup/ ma 
> purtroppo il processo non va a buon fine. Ricevo sempre lo stesso 
> errore dovuto all'assenza di ID dell'oggetto
>
>     Traceback (most recent call last):
>     File "<stdin>", line 1, in <module>
>     File
>     "/Workspace/Plone/eggs/Products.BTreeFolder2-2.13.3-py2.7.egg/Products/BTreeFolder2/BTreeFolder2.py",
>     line 172, in _cleanup
>     check(self._tree)
>     File
>     "/Workspace/Plone/eggs/ZODB3-3.10.5-py2.7-linux-i686.egg/BTrees/check.py",
>     line 405, in check
>     Checker(btree).check()
>     File
>     "/Workspace/Plone/eggs/ZODB3-3.10.5-py2.7-linux-i686.egg/BTrees/check.py",
>     line 316, in check
>     self.walk()
>     File
>     "/Workspace/Plone/eggs/ZODB3-3.10.5-py2.7-linux-i686.egg/BTrees/check.py",
>     line 251, in walk
>     kind, is_mapping = classify(obj)
>     File
>     "/Workspace/Plone/eggs/ZODB3-3.10.5-py2.7-linux-i686.egg/BTrees/check.py",
>     line 69, in classify
>     return _type2kind[type(obj)]
>     KeyError: <type 'NoneType'>
>
> Altre idee/suggerimenti su come risolvere?
> Grazie a tutti nuovamente per la disponibilità!
>
> Roberto
>
>
> Il 01/08/2017 10:31, sauzher ha scritto:
>> Ciao roberto,
>> I Btree hanno metodi di pulizia
>>   def _cleanup(self):
>>         """Cleans up errors in the BTrees.
>>
>>         Certain ZODB bugs have caused BTrees to become slightly insane.
>>         Fortunately, there is a way to clean up damaged BTrees that
>>         always seems to work: make a new BTree containing the items()
>>         of the old one.
>>
>>         Returns 1 if no damage was detected, or 0 if damage was
>>         detected and fixed.
>>         """
>>
>> potresti accedere in bin/instance debug e tentare.
>>
>> alessandro.
>>
>> Il giorno 1 agosto 2017 09:56, Yuri <yurj a alfa.it 
>> <mailto:yurj a alfa.it>> ha scritto:
>>
>>     L'unica è determinare l'oid e con quello accedere tramite zodb e
>>     correggere l'oggetto.
>>
>>
>>     Il 31/07/2017 15:57, Roberto Rascioni ha scritto:
>>
>>         Ciao a tutti!
>>
>>         ho un problema molto strano che mi hanno segnalato da qualche
>>         giorno:
>>
>>         quando si cerca di accedere ad una determinata cartella si
>>         riceve l'errore
>>
>>         Module Products.BTreeFolder2.BTreeFolder2, line 332, in
>>         objectCount
>>         TypeError: 'NoneType' object is not callable
>>
>>         La cartella non ha più ID e non si riesce né a rinominare né
>>         cancellare
>>
>>         ValueError: No object with id "" exists
>>
>>         Ho provato ad utilizzare il metodo *@@**migrate-btrees*
>>         <http://blog.redturtle.it/2014/03/26/migrazioni-sorprese-gestire
>>         <http://blog.redturtle.it/2014/03/26/migrazioni-sorprese-gestire>>
>>         descritto nel blog di redTurtle
>>         e ad eseguire il /Clear and Rebuild/ del catalogo ma senza
>>         risultati
>>
>>         Ho provato anche a creare uno script python per rinominare la
>>         cartella, ma anche lì ricevo lo stesso errore descritto sopra
>>         (id "" non esistente)
>>
>>         Qualcuno di voi ha idea di come posso recuperare la cartella?
>>
>>         Grazie a tutti in anticipo!
>>
>>         Roberto
>>         **
>>         <http://blog.redturtle.it/2014/03/26/migrazioni-sorprese-gestire
>>         <http://blog.redturtle.it/2014/03/26/migrazioni-sorprese-gestire>>
>>
>>
>>         _______________________________________________
>>         Plone-IT mailing list
>>         Plone-IT a lists.plone.org <mailto:Plone-IT a lists.plone.org>
>>         https://lists.plone.org/mailman/listinfo/plone-plone-it
>>         <https://lists.plone.org/mailman/listinfo/plone-plone-it>
>>         http://plone-regional-forums.221720.n2.nabble.com/Plone-Italy-f221721.html
>>         <http://plone-regional-forums.221720.n2.nabble.com/Plone-Italy-f221721.html>
>>
>>
>>     _______________________________________________
>>     Plone-IT mailing list
>>     Plone-IT a lists.plone.org <mailto:Plone-IT a lists.plone.org>
>>     https://lists.plone.org/mailman/listinfo/plone-plone-it
>>     <https://lists.plone.org/mailman/listinfo/plone-plone-it>
>>     http://plone-regional-forums.221720.n2.nabble.com/Plone-Italy-f221721.html
>>     <http://plone-regional-forums.221720.n2.nabble.com/Plone-Italy-f221721.html>
>>
>>
>>
>>
>> -- 
>>     bye
>> alessandro ceglie (aka sauzher)
>> ************************************
>> l'iterazione è umana...
>> la ricorsione, Divina!
>> ************************************
>> reply to: sauzher AT gmail DOT com
>>
>>
>> _______________________________________________
>> Plone-IT mailing list
>> Plone-IT a lists.plone.org
>> https://lists.plone.org/mailman/listinfo/plone-plone-it
>> http://plone-regional-forums.221720.n2.nabble.com/Plone-Italy-f221721.html
>
>
> -- 
> dott. Roberto Rascioni - Ufficio Web, E-Learning, Sviluppo & Ricerca
>
> CSIA - Università degli studi di Macerata
> Vicolo Tornabuoni, 58 - 62100 Macerata
> Tel +39 0733.258.4408 - Fax +39 0733.258.4415
> http://www.unimc.it
>
> This e-mail transmission may be legally privileged and contains 
> confidential information that is the property of the sender and the 
> organization (UNIVERSITY OF MACERATA) for which the sender represents. 
> If you are not the intended recipient and have by accident received 
> this email, please do not retain, disclose, reproduce or distribute 
> the contents of this e-mail transmission, or take any action in 
> relevance thereon or pursuant thereto. Please notify the sender of the 
> error by responding to the email accordingly in a timely and 
> reasonable fashion otherwise failure to do so may cause legal action 
> to be taken. Thank you.
>
>
> _______________________________________________
> Plone-IT mailing list
> Plone-IT a lists.plone.org
> https://lists.plone.org/mailman/listinfo/plone-plone-it
> http://plone-regional-forums.221720.n2.nabble.com/Plone-Italy-f221721.html



-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.plone.org/pipermail/plone-plone-it/attachments/20170804/ea12fc22/attachment.html>


Maggiori informazioni sulla lista Plone-IT