Re: Edit archetypes2(the previous has errors)

Raphael Ritz <[email protected]>
Newsgroups gmane.comp.web.zope.plone.archetypes.devel
Organization Humboldt-University Berlin
Message-ID <[email protected]>
Ramiro Eduardo wrote:
> Hello, I have two problemas. The first is that I don't know the 'Tittle' and
> 'Id' when I go to create a item (the idea is set this values from a script) on
> the edit form.

Hi Ramiro,

http://docs.neuroinf.de/programming-plone/ate

and in particular

http://docs.neuroinf.de/programming-plone/ate#2-23

might give you some pointers.

> My second problem is that I don't know to do that a item
> attribute (that previous I have created it) is a primary key (I want say: "Plone
> can't be two items with the same field value").And how can do to have two field
> primary key????

Not sure I understand your question here:
In archetypes, fields have a property called 'primary' which
defaults to False and which tells the 'PrimaryFieldMarshaller'
which field's value to return on serialization requests
Having more than one field declared 'primary' doesn't make
much sense but won't break your system as the marshaller
just takes the first primary field it finds.

If you are asking: how do I provide two fields in a schema
that manage the same value? Look for what we call "field sharing".
Example

Schema((StringField('field1'),
         StringField('field2',
            accessor="getField1",
            edit_accessor="getRawField1",
            mutator="setField1",
          )
        ))

Now 'field1' and 'field2' are synchronized in terms of their
value but can be configured differently (e.g., be part of
different schemata sets, have different visibility, different
help messages, etc.)
> 
> Sorry for my English!!!!

No reason to excuse. There are a lot non-native English
speakers around here.

Raphael

> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.