[Zope-CMF] Metadata Element -- how to register

Norman Khine norman@bmpublications.co.uk
Mon, 6 Aug 2001 16:40:04 +0100


Hi,
I have included a new Metadata Element called Categories, it is added to the
Elements tab.

Now I want to include it to the metadata_edit_form, this element is based on
the subject element, so I tried to copy the entry for the Subject


<tr valign="top">

  <th align="right"> Category </th>
  <td>
   <dtml-let contentCategory=Category
             allowedSubjects="portal_metadata.listAllowedCategory( this() )"
   >

<dtml-in Category
                ><dtml-let item=sequence-item
                ><dtml-unless expr="item in allowedCategory"
                ><dtml-var sequence-item>
</dtml-unless></dtml-let></dtml-in></textarea>

   <br>
    <select name="category:list" multiple>
     <dtml-in allowedCategory>
     <dtml-let item=sequence-item
               sel="item in contentCategory and 'selected' or ''"
     >
      <option value="&dtml-sequence-item;"
              &dtml-sel;> &dtml-sequence-item; </option>
     </dtml-let>
     </dtml-in>
    </select>
   </dtml-let>
  </td>


but got an error:

Error Type: KeyError
Error Value: Category

Traceback (innermost last):
  File /usr/home/dsuk5/zope/2.4.0/lib/python/ZPublisher/Publish.py, line
223, in publish_module
  File /usr/home/dsuk5/zope/2.4.0/lib/python/ZPublisher/Publish.py, line
187, in publish
  File /usr/home/dsuk5/zope/2.4.0/lib/python/Zope/__init__.py, line 226, in
zpublisher_exception_hook
    (Object: DynamicType)
  File /usr/home/dsuk5/zope/2.4.0/lib/python/ZPublisher/Publish.py, line
171, in publish
  File /usr/home/dsuk5/zope/2.4.0/lib/python/ZPublisher/mapply.py, line 160,
in mapply
    (Object: metadata_edit_form)
  File /usr/home/dsuk5/zope/2.4.0/lib/python/ZPublisher/Publish.py, line
112, in call_object
    (Object: metadata_edit_form)
  File /usr/home/dsuk5/zope/2.4.0/lib/python/OFS/DTMLMethod.py, line 194, in
__call__
    (Object: metadata_edit_form)
  File /usr/home/dsuk5/zope/2.4.0/lib/python/DocumentTemplate/DT_String.py,
line 544, in __call__
    (Object: metadata_edit_form)
  File /usr/home/dsuk5/zope/2.4.0/lib/python/DocumentTemplate/DT_Let.py,
line 146, in render
    (Object: contentCategory=Category

            allowedSubjects="portal_metadata.listAllowedCategory( this() )")
KeyError: (see above)

Any ideas as to how I can add a new metadata element based on the Subject
Element?

Regards

Norman