Python
Plone email gateway proposal
To encourage people to blog more with plone/quills what I think we need is an email gateway, to at least get the content to the site. I've tried to research what other blogging agents do, and it basically appears that a special email account per blog is set up. My proposal is as follows:
- Set up a single blog email address for each plone instance (research, verg, dart, hpc,...)
- Have each instance check its box at a given periodicy
- Each user on the site can set preferences specifying the default blog and categories for email blogs
- When an email arrives it is mapped, using the From address to a user, then to a blog and category. Overrides should be allowed, perhaps in the body?
- If the message is not signed (PGP, S/MIME) then the blog sits in the drafts to be published. (normal quills interface) Send a reply email with a link to the drafts folder.
- If the email is sigend it is published immediately.
- If it doesn't map to a user drop the email
powered by performancing firefox
Cleaning up after cancelled AT, and still using the parent node
Filed Under:
Python
An AT BaseContent derived product does not clean up after itself if I go Add, then press Cancel. I'm left with an object "named" [...]. As explained here, you need to register your type with the portal_factor so that cancellations are cleaned up. However, doing this means you can't use the self.getParentNode() method until the object is saved. So defaults and the like will not work if they derive their values from the parent. There is a methid, self.getFolderWhenPortalFactory(), which overcomes this problem. If you are not using the portal_factory then it will just return the parent. If you are using the portal_factory then it will return the folder where the object was created!
powered by performancing firefox
Archetype lifecycle
Filed Under:
Python
This is from my traces which I ran against a BaseContent type, using these docs as a guide.
User | Plone |
---|---|
Create object | |
manage_afterAdd | |
(Edit page displayed) Save | |
manage_beforeDelete manage_afterAdd at_post_create_script | |
(Saved item shown) Click edit | |
(None) | |
(Edit page displayed) Save | |
at_post_edit_script | |
(Saved item shown) Click delete | |
manage_beforeDelete |
powered by performancing firefox
Some Archetype notes
Filed Under:
Python
I've been playing around with writing my own plone product from scratch for a totally unrelated purpose, but in the midst of this I've made a few important starter hints for useing Archetypes.
- BaseFolder and BaseContent are the types to inherit from
- To set defaults from the parent of a content, set the
default_method = 'get_default_value_x'
def get_default_value_x(self):
self.getParentNode()... - Or, overrider the initializeArchetype method
- Set the meta_type static variable for the object
- To restrict types on a BaseFolder allowed_content_types = ( 'TypeA', 'TypeB')
- And on save is manage_afterEdit (I have not tested this myself yet)
powered by performancing firefox