The (Specific) Placement of Custom Content Type Code

26 views
Skip to first unread message

Ron Chichester

unread,
Sep 5, 2015, 3:01:26 PM9/5/15
to substanced-users
Hi:

First, thanks to all who work on Substance D.  This project has great promise.

I was reading through the documentation, specifically the part about defining content.  (http://docs.pylonsproject.org/projects/substanced/en/latest/content.html).  That document was a great introduction to making your own object types, and gave examples.  

The thing that was missing from that documentation, or the thing that I found particularly elusive was *where* to put that file so that Substance D would see it and incorporate that new Content Type.  If I was to make my own module named blog.resources, where would I save it so that Substance D could make use of it?

Thanks again...

Carlos de la Guardia

unread,
Sep 5, 2015, 4:19:45 PM9/5/15
to substanc...@googlegroups.com
Hi,

you can put it anywhere inside your package. If you are using the @content decorator to declare your content type, all you need to do is make sure your __init__.py calls config.scan() and the content will be initialized. Scan is a Pyramid concept, which is why it's not explained there. We might need to make a link from the content docs to here:


Instead of using scan(), you could also import your content from any module and use call config.add_content_type:

config.add_content_type('Blog Entry', BlogEntry)

Hope that helps.

Carlos de la Guardia


From: Ron Chichester <com...@gmail.com>
To: substanced-users <substanc...@googlegroups.com>
Sent: Saturday, September 5, 2015 2:01 PM
Subject: The (Specific) Placement of Custom Content Type Code

--
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.


Reply all
Reply to author
Forward
0 new messages