Re: Allowed types programmatically on dexterity content

Philip Bauer <[email protected]>
Newsgroups gmane.comp.web.zope.plone.user
Message-ID <[email protected]>
See http://plone-training.readthedocs.org/en/latest/user_generated_content.html

def constrain(context, allowed_types):
    behavior = ISelectableConstrainTypes(context)
    behavior.setConstrainTypesMode(constrains.ENABLED)
    behavior.setLocallyAllowedTypes(allowed_types)
    behavior.setImmediatelyAddableTypes(allowed_types)

Philip

--
Starzel.de
Philip Bauer
Adlzreiterstr. 35
80337 München
Tel: 089 - 189 29 533
Fax: 089 - 189 29 535
[email protected]
www.starzel.de

> Am 26.03.2015 um 18:56 schrieb Bruno Barbosa <[email protected]>:
> 
> Thanks Johannes!
> 
> it will be very useful.
> 
> 
> 
> --
> Bruno Barbosa
> [email protected]
> 
> 
> On Wed, Mar 25, 2015 at 6:18 PM, Johannes Raggam <[email protected]> wrote:
> This is a start: use this behavior for your content type:
> 
> Products.CMFPlone.interfaces.constrains.ISelectableConstrainTypes
> 
> Now you should be able to set the constraint types. Look at the behavior
> implementation to get an idea on how to do that.
> 
> Cheers, Johannes
> 
> 
> 
> On Wed, 2015-03-25 at 18:09 -0300, Bruno Barbosa wrote:
> > ​​
> > ​​Hello,
> >
> > In my project I need to setup programmatically the allowed types at
> > add-menu on custom content type.
> >
> > On google, I found the follow link:
> > http://stackoverflow.com/questions/5194464/how-to-programmatically-control-an-objects-add-menu-list-of-allowed-content-type
> >
> > But unfortuna​tel​y don't works for me because I'm using dexterity
> > instead of AT.
> >
> >
> > Someone has a tip about how to do it with dexterity?
> >
> >
> > att,
> >
> > --
> > Bruno Barbosa
> > [email protected]
> > ​
> >
> >
> > ------------------------------------------------------------------------------
> > Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> > by Intel and developed in partnership with Slashdot Media, is your hub for all
> > things parallel software development, from weekly thought leadership blogs to
> > news, videos, case studies, tutorials and more. Take a look and join the
> > conversation now. http://goparallel.sourceforge.net/
> > _______________________________________________ Plone-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/plone-users
> 
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/_______________________________________________
> Plone-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/plone-users

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/

_______________________________________________
Plone-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plone-users
signature.asc (application/pgp-signature, 496 B)
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQEcBAEBCgAGBQJVFFQ2AAoJEOeXgSbn9GtJN30IAI5eJ/hmluYZuH+cRxGE8/xY
Bn/i+MAF/rQJBWUXmqylBeItSizwZM03yZUPD5/y2TqsV2xby5fU0GzC0EkmrGyK
pHjQ+oijIgoplO85NVo+5n2+P6OABKkvLo55TaZbnUbcozL7A880yT3L1EbTgKzw
BNKdAkYuozhh/ZknMwBrz6MEsmaD7Y9fiUNcbNOxy997Qx7Jn99TQ6zARuuJoLd9
IvtlwNIfwY5xsL094u0r5ehT32igi0fS5w3DgSAbu8L4Y/H7ndEi5dIA+z0FOrO3
Y8ei0ISzUyLVooevcckfbxORJ7GXMMCfAVGKcXRdZ94bOH2idMjY11du60IxWYc=
=7YqK
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.