objects.bcxml.net improvementsΒΆ

Tags: aec

Hmmm. I'm actually a bit in doubt where to post this. I've added some news items to object.bmxl.net itself, but I'm the only one reading that, probably. So I'm taking the risk of scaring everybody away by posting it here. Python/plone programmers will find some code near the end :-)

objects.bcxml.net is a experimental site where a graduate student (Noor Hellemans), my professor (Frits Tolman) and myself are creating an functional_unit/technical_solution-based ontology, FU (functional unit) meaning objects on the demand side ("you want something functional, with functional requirements") and TS (technical solution) meaning objects on the supply side (a real, technical solution for your functional demand). A FU can be fulfilled my multiple TS, a TS consists of a couple of follow-up FU details. And so on. It's a pretty easy and elegant system when you think about it for a while.

Ok, now the news :-) I've made some improvements last evening/this night.

  • Couple of visual improvements, like displaying identifying icons in front of items (question mark for FU, exclamation mark for TS, etc.).
  • I added a detection mechanism for duplicate objects, with the possibility to merge them.
  • I added "collections", just a grouping mechanism for (demand-side) functional units. You might call it a power type, but that is something I'm intending to write about a bit later as I'm still trying to get my head around it. Effectively, when you're busy adding FU/TS, there are some things that are neither. When those things are more like a collection of FUs than FUs themselves, now you've got a place to put them.
  • Silly-sounding, but listings of folder contents is now alphabetical...

Read on for a couple of pieces of python/plone code. Sorting folder listings in plone 2.0

After a bit of googling I went to /portal_skins/plone_scripts/batchedFolderContents and customised that. I added the following after the first try..except clause:

  contents.sort(lambda a,b: cmp(a.Title().lower(), b.Title().lower()))

Adding objects programmatically

I'm adding some objects to plone from my program code instead of using the normal plone web interface. What bit me there was that those objects didn't get included in the catalog. Which meant that you couldn't search for them, etc. So if you're doing something similar: don't forget to call something like this:

  object.indexObject()

Content type icons

When you're using archetypes' reference mechanism, the newest versions constantly put icons in front of your objects. I mean, on this weblog external links have a globe icon in front of them; that globe is a link's content type icon. I kinda like that behaviour, so I've sprinkled code like the following throughout my page templates:

  {a href="#"
     tal:attributes="href some_object/absolute_url"
     }{img tal:attributes="src some_object/getIcon"/}
     {span tal:content="some_object/title"/}
  {/a}
  {span tal:condition="some_object/description"}
    ({span tal:content="some_object/description"/})
  {/span}

Note that I've replaced the html angle backets with braces as I had some cut/paste problems.

 
vanrees.org logo

Reinout van Rees

My name is Reinout van Rees and I program in Python, I live in the Netherlands, I cycle recumbent bikes and I have a model railway.

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):