Plonemultisite and ReftextField: copying along imagesΒΆ

Tags: plone

We're using plone multisite to have one "source" plone site that can push content to various "target" plone sites. Works pretty well. Our customer had a new request: if you add images to the source site and include them in the kupu editor, they ought to be pushed along with the actual object you're working on. It looked a bit complicated, so I send off an email to the plone users mailinglist.

Duncan was quick to reply that kupu includes a ReftextField that can serve as a drop-in replacement of the regular TextField. The change is that it adds archetype references to the images that are included. And... archetype references are used by plone multisite to detect dependent content that should be dragged along to the target site! A bit of coding later and it worked. Great :-) Some comments:

  • You need to enable "link by uid", as the ReftextField doesn't detect the images otherwise.
  • I ran into a small bug when changing the TextField of atcontenttypes content to ReftextField and creating a new object. I've submitted a small fix for that which 'll end up in an upcoming release.

I could hardly find any reference to ReftextField, so I thought a blog entry was in order to draw some attention to it :-)

Tags:

(Old imported comments)
"2.5" by reinout on 2007-12-06 18:51:45
This is for a 2.5 site.

Bug is that atct's text field gets initialized as a BaseUnit (with a mimetype attribute) instead of as an empty string. ReftextField's set() method then things "not a string? Let's do a seek()". And BaseUnit gives an AttributeError.

Solution: add an "if BaseUnit" and do a "value = value()". Two-line fix, now included in kupu.
"Yeah, ReftextField is great!" by http://duffyd.myopenid.com/ on 2007-12-05 22:19:26
Yeah, I've used it a couple of times on different Plone sites now, and discovered the need to enable "link by uid" also. Funnily enough, in Plone 2.1.x you didn't need to do this :) Is your site a Plone 2.5.x or 3.x site?
Unsure what bug you discovered in ATContentType CTs but I noticed when subclassing content based on ATCT, I had to set the 'text' field to not be required (in the schema) and then modify the document_view (or whatever view template) to show my new ReftextField and not the default one (as well as the edit template iirc).
blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):