Is there a minimum set of meta data to go with a custom content type?

34 views
Skip to first unread message

Jo G

unread,
Sep 22, 2015, 9:47:58 AM9/22/15
to substanced-users
I have created my own content types based on substanced folder type. The are called book, poem and person. They are all created using the content decorator.
I have created separate python packages for each content type. The init file of each package has an includeme function with one line -config.scan.
I then have a pyramid application which requires some or all of these packages and 'scans' all of them to include the required content types.
This all works fine. 

The next step is that these are 'base content types' (in the same way as Folder and File are for substanced). I now want to create a new pyramid application which includes other content types based on the base content types. For example my new application should include packages for new_book and new_poem where new_book and new_poem are content types which inherit from book and poem.

I set all this up and had a pyramid application which required all the base and the new packages but when I ran the application I couldn't 'see' any of the new content types from introspectable.get('content_type'). The only way I could 'see' the content type in the root was to give the new content type decorator an 'add_view' meta keyword. Do I have to have an add_view keyword? 

In most cases I will be able to use the base content types so won't need any changes to the content type BUT I would like to have new_book and new_poem even if all they do is pass everything on to the base class. In some cases I will need to add new properties or change the validation on the schema.

Am I going about this the wrong way? 

I did look at 
http://docs.pylonsproject.org/projects/substanced/en/latest/content.html?highlight=content and follow what is given but it doesn't answer my question.

Many thanks

Carlos de la Guardia

unread,
Sep 22, 2015, 6:53:22 PM9/22/15
to substanc...@googlegroups.com
To "see" a content type in the add menu of the SDI, 'add_view' is required, since this is precisely what is used to build the list of addable types. It's optional because there could be situations where there is a need for a content type that never will be added manually in the SDI, but only programmatically.

Carlos de la Guardia


From: Jo G <joannegil...@gmail.com>
To: substanced-users <substanc...@googlegroups.com>
Sent: Tuesday, September 22, 2015 8:47 AM
Subject: Is there a minimum set of meta data to go with a custom content type?

--
You received this message because you are subscribed to the Google Groups "substanced-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to substanced-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jo G

unread,
Sep 23, 2015, 5:36:16 AM9/23/15
to substanced-users, cgua...@yahoo.com
Ok, I can see that that would make sense to offer the programmatic option of creating a content type. This isn't documented and it took me best part of a day to understand why my new custom content type wasn't appearing in  introspectable.get('content_type'). To be honest I still can't see why it doesn't get added even after stepping through the code. Maybe I'm looking in the wrong place. Is there any way to get the documentation updated to reflect this? Can I do it?
Reply all
Reply to author
Forward
0 new messages