[Product-Developers] Remove dashes from shortname - override choosename in namechooser.py?

Giacomo Spettoli giacomo.spettoli at gmail.com
Wed Jul 27 22:13:29 UTC 2011


Il 27/07/2011 20:34, imran.azad ha scritto:
> Hi,
>
> I want to remove the dashes from the shortname of the object. In other words
> I want to remove all dashes in the id of an object. I have noticed there is
> a function in namechooser.py called chooseName which does the following:
>
> name = getUtility(IURLNormalizer).normalize(name)
>
> if I set the variable to:
>
> name = name
>
> It works! And the dashes aren't added. However this approach is modifying
> the Plone Core :-(
> I want to avoid doing this, I would rather like to override the chooseName
> function.
>
> How can I do this from my class(custom content type using Dexterity)
>
> Thank You
>
> --
> View this message in context: http://plone.293351.n2.nabble.com/Remove-dashes-from-shortname-override-choosename-in-namechooser-py-tp6627262p6627262.html
> Sent from the Product Developers mailing list archive at Nabble.com.
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> https://lists.plone.org/mailman/listinfo/plone-product-developers


Hi,
    you can customize the behaviour of name normalization by registering 
a local utility that implements IURLNormalizer interface.

Read more here:
http://plone.org/documentation/manual/developer-manual/generic-setup/reference/component-registry

Giacomo

--
Giacomo Spettoli

twitter: http://twitter.com/giacomospettoli
linkedin: http://linkedin.com/in/giacomospettoli
company site: http://redomino.com
blog: http://www.spettoli.com


More information about the Product-Developers mailing list