Delete dex class

classic Classic list List threaded Threaded
6 messages Options
Mike Metcalfe-4 Mike Metcalfe-4
Reply | Threaded
Open this post in threaded view
|

Delete dex class

Hi,

Can anyone tell me how to delete an obsolete class in an upgrade step?

Thanks

--
Mike Metcalfe

082 903 8268

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Luca Fabbri Luca Fabbri
Reply | Threaded
Open this post in threaded view
|

Re: Delete dex class



On Thu, Jan 15, 2015 at 9:13 AM, Mike Metcalfe <[hidden email]> wrote:
Hi,

Can anyone tell me how to delete an obsolete class in an upgrade step?


What you mean with "delete a class" ?





--
Mike Metcalfe

082 903 8268

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users




--

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
aclark aclark
Reply | Threaded
Open this post in threaded view
|

Re: Delete dex class

On 1/15/15 6:54 AM, Luca Fabbri wrote:
>
>
> On Thu, Jan 15, 2015 at 9:13 AM, Mike Metcalfe
> <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi,
>
>     Can anyone tell me how to delete an obsolete class in an upgrade step?

I'm going to guess he means instances of a class which has been removed.
And I'm also going to guess the answer is something like [1]:

- Include code somewhere to alias modules for obsolete classes e.g.
my.old.class = my.new.class

- Create new instances e.g. for i in my.old.class.instances(): j =
my.new.class.instance(); [j.field = i.field for i.fields in i]

Otherwise you have broken objects in the ZODB which can't be as easily
handled.

[1] Disclaimer: It's been a while, so I could be wrong.

>
>
> What you mean with "delete a class" ?
>
>
>
>
>
> --
> Mike Metcalfe
>
> 082 903 8268
> [hidden email] <mailto:[hidden email]>
> www.webtide.co.za <http://www.webtide.co.za/>
>
>
>     ------------------------------------------------------------------------------
>     New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
>     GigeNET is offering a free month of service with a new server in
>     Ashburn.
>     Choose from 2 high performing configs, both with 100TB of bandwidth.
>     Higher redundancy.Lower latency.Increased capacity.Completely compliant.
>     http://p.sf.net/sfu/gigenet
>     _______________________________________________
>     Plone-Users mailing list
>     [hidden email]
>     <mailto:[hidden email]>
>     https://lists.sourceforge.net/lists/listinfo/plone-users
>
>
>
>
> --
> -- luca
>
> twitter: http://twitter.com/keul
> linkedin: http://linkedin.com/in/lucafbb
> blog: http://blog.keul.it/
>
>
> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> http://p.sf.net/sfu/gigenet
>
>
>
> _______________________________________________
> Plone-Users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-users
>


--
Alex Clark · http://about.me/alex.clark


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Mike Metcalfe-4 Mike Metcalfe-4
Reply | Threaded
Open this post in threaded view
|

Re: Delete dex class

Sorry to have you guessing. I have an upgrade step that finds and deletes all instances of a class and now I'd like to delete the class itself. Is this the correct way:
        ttool = getToolByName(portal, 'portal_types')
        ttool.manage_delObjects([id])


On 18 January 2015 at 16:31, Alex Clark <[hidden email]> wrote:
On 1/15/15 6:54 AM, Luca Fabbri wrote:
>
>
> On Thu, Jan 15, 2015 at 9:13 AM, Mike Metcalfe
> <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi,
>
>     Can anyone tell me how to delete an obsolete class in an upgrade step?

I'm going to guess he means instances of a class which has been removed.
And I'm also going to guess the answer is something like [1]:

- Include code somewhere to alias modules for obsolete classes e.g.
my.old.class = my.new.class

- Create new instances e.g. for i in my.old.class.instances(): j =
my.new.class.instance(); [j.field = i.field for i.fields in i]

Otherwise you have broken objects in the ZODB which can't be as easily
handled.

[1] Disclaimer: It's been a while, so I could be wrong.

>
>
> What you mean with "delete a class" ?
>
>
>
>
>
> --
> Mike Metcalfe
>
> <a href="tel:082%20903%208268" value="+27829038268">082 903 8268
> [hidden email] <mailto:[hidden email]>
> www.webtide.co.za <http://www.webtide.co.za/>
>
>
>     ------------------------------------------------------------------------------
>     New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
>     GigeNET is offering a free month of service with a new server in
>     Ashburn.
>     Choose from 2 high performing configs, both with 100TB of bandwidth.
>     Higher redundancy.Lower latency.Increased capacity.Completely compliant.
>     http://p.sf.net/sfu/gigenet
>     _______________________________________________
>     Plone-Users mailing list
>     [hidden email]
>     <mailto:[hidden email]>
>     https://lists.sourceforge.net/lists/listinfo/plone-users
>
>
>
>
> --
> -- luca
>
> twitter: http://twitter.com/keul
> linkedin: http://linkedin.com/in/lucafbb
> blog: http://blog.keul.it/
>
>
> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> http://p.sf.net/sfu/gigenet
>
>
>
> _______________________________________________
> Plone-Users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-users
>


--
Alex Clark · http://about.me/alex.clark


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users



--
Mike Metcalfe

082 903 8268

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
David Glick (Plone) David Glick (Plone)
Reply | Threaded
Open this post in threaded view
|

Re: Delete dex class

On 1/18/15 11:48 PM, Mike Metcalfe wrote:
> Sorry to have you guessing. I have an upgrade step that finds and
> deletes all instances of a class and now I'd like to delete the class
> itself. Is this the correct way:
>         ttool = getToolByName(portal, 'portal_types')
>         ttool.manage_delObjects([id])
>
That deletes the "factory type info" (FTI) object from portal_types, not
the class. But perhaps that's what you meant? If your type used a custom
class rather than the standard Item or Container, the FTI holds a
reference to the class. So removing the FTI would take you one step
closer to being able to safely delete the code for the class.

Instead of writing custom upgrade coe you could remove the FTI in
types.xml in your GenericSetup profile, by specifying remove="true" for
the FTI object.

David

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Mike Metcalfe-4 Mike Metcalfe-4
Reply | Threaded
Open this post in threaded view
|

Re: Delete dex class

Thanks David, I'll try using remove.

On 20 January 2015 at 03:57, David Glick (Plone) <[hidden email]> wrote:
On 1/18/15 11:48 PM, Mike Metcalfe wrote:
Sorry to have you guessing. I have an upgrade step that finds and deletes all instances of a class and now I'd like to delete the class itself. Is this the correct way:
        ttool = getToolByName(portal, 'portal_types')
        ttool.manage_delObjects([id])

That deletes the "factory type info" (FTI) object from portal_types, not the class. But perhaps that's what you meant? If your type used a custom class rather than the standard Item or Container, the FTI holds a reference to the class. So removing the FTI would take you one step closer to being able to safely delete the code for the class.

Instead of writing custom upgrade coe you could remove the FTI in types.xml in your GenericSetup profile, by specifying remove="true" for the FTI object.

David



--
Mike Metcalfe

082 903 8268

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users