[Product-Developers] Re: Programatically only addable content types

Vanderson Mota dos Santos vanderson.mota at gmail.com
Thu Feb 12 12:47:51 UTC 2009


Well, it was a "legacy" code that was calling _renameAfterCreation(), and
then sets the title. But when this method is called, it performs a security
check.
So, in order to get rid of this and set the title i did like this:

 _createObjectByType(type_name, container, id, title=title)
and got rid of the evil _renameAfterCreation()

and it works! Thanks everyone for the help!

2009/2/12 Raphael Ritz <r.ritz at biologie.hu-berlin.de>

> Ricardo Newbery wrote:
>
>>
>> [Please use "replay all" to stay on the list so that others with similar
>> issues may benefit]
>>
>>
>> On Feb 11, 2009, at 1:35 PM, Vanderson Mota dos Santos wrote:
>>
>>  Well, after the object creation, i call _renameAfterCreation()
>>>
>>
> Don't do that.
>
> It also shouldn't be necessary as you provide the id on creation
> anyway.
>
> RenameAfterCreation is meant to provide a way to get rid of
> automatically generated ids which typically are quite ugly.
>
> What happens is that the regular cut&paste machinery kicks in
> on rename and that does indeed check whether the object's type
> is allowed in that container.
>
> Raphael
>
>
>  that
>>
>>> raises the error described in my previous post. Sorry guys, i've hurried
>>> up to answer before debugging. It will not happen again. =)
>>>
>>> 2009/2/11 Vanderson Mota dos Santos <vanderson.mota at gmail.com>
>>> "from Products.CMFPlone.utils import _createObjectByType
>>> _createObjectByType(type_name, container, id)"
>>>
>>> Just Followed your tip, but, didn't worked. Keeps bugging me with the
>>> "Disallowed subobject type" error
>>>
>>> Any other stuff that i can try?
>>>
>>
>>
>> What do you mean, you call _renameAfterCreation() ?  This is a method you
>> can redefine, but I don't think you're meant to call it explicitly.
>>
>> Note, I believe there is a bug in LinguaPlone that can trip you up
>> whenever you try to edit an existing object that would normally be
>> disallowed in the container.  One solution is to set
>> _at_rename_after_creation=False in the contenttype.  Perhaps this has
>> something to do with your problem?
>>
>> Ric
>>
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers
>



-- 
Vanderson Mota dos Santos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20090212/6607377b/attachment.html>


More information about the Product-Developers mailing list