Get The Value of a Dexterity form.field

Hello,

I created a Dexterity add-on with some modules with different form fields. I have one module that has especially the following two form fields:

form.mode(title='hidden')
title = schema.TextLine(
title=(u"Title"),
description=
(u"Release Title"),
min_length=5,
defaultFactory= getContainerTitle
)

releasenumber=schema.TextLine(
title=(u"Release Number"),
description=
(u"Release Number (up to eight chars)"),
default=_(u"1.0"),
max_length=8
)

I want to create a default value for the hidden title field of the release module. This value should be created from the value of the parent objects title and the value of the field releasenumber.

I'm able to get the value from the title field of the parent object with:

context.title
or
self.aq_inner.title

But I have issues to get the value of the releasenumber field.
I could access the object with:
NameOfSchemaClass['field_name']
e.g. : IEUpRelease['releasenumber']

But I don''t get the current value of the field back. I need to get back an unicode string instead of an object.

I've already searched for a way to get the value out of the Dexterity form field but with no success yet.

Thanks for any hints in advance
Andreas

Does this help?
http://davidjb.com/blog/2010/04/plone-and-dexterity-working-with-computed-fields/http://davidjb.com/blog/2010/04/plone-and-dexterity-working-with-computed-fields/

If not, I think you need to show us the whole class.

I'm afraid, that doesn't help.

I created a new module with a class for a computed release title to my add-on, inherited from plone.dexterity.content:Item.
I added this new class to the xml-type description and reinstalled the add-on again. If I try to add a new release to a project, my plone instance get high load and circles without any success (I could view the high load from Python inside top).

My source code is here:


The release module is here:

Andreas

Not sure, but I'd try playing around with pdb in getContainerTitle and see what you've really got in the releasenumber field.

Hello,

thank you for the pointer again. I read the blog post carefully again and started with the second part first. I changed my source code for the URL creation first and worked on the creation of the title/navtree-entry afterwards.
I stumbled over the(in the blog) described issue with setting the title attribute first. This issue was solved once I deleted the title form field in my release type and added another field to host the project name (parent container name).
I committed my changes already to the github repo.

Thanks for your help
Andreas

Well done! I wasn't following everything, but glad to send you in the right direction!