官术网_书友最值得收藏!

Generating code

At this stage, we have drawn the definitions for a new content type based on Plone's default News Item but with some differences: there's a lead field, a country field, and a modified relatedItems field. There's also a new countryVocabulary method that will provide the country options list for that field.

Generating code

To turn all these drawings into a Plone usable content type, we must finally use ArchGenXML.

How to do it…

  1. Save the model as poxContentTypes.zargo inside the models folder we created before.
  2. Go to your ArchGenXML models folder and run:
    cd ~/libexec/archgenxml/models
    ../bin/archgenxml ./poxContentTypes.zargo
    
  3. If everything is okay, you'll get an output similar to this:

    INFO ArchGenXML Version 2.4.1

    (c) 2003-2009 BlueDynamics Alliance, Austria, GPL 2.0 or later

    INFO Directories to search for profiles: ['~/archgenxml/profiles']

    INFO Parsing...

    INFO Profile files: '{u'archgenxml_profile.xmi': u'~/archgenxml/profiles/archgenxml_profile.xmi'}'

    INFO Directory in which we're generating the files: ''.

    INFO Generating...

    INFO Starting new Product: 'poxContentTypes'.

    INFO Generating package 'content'.

    INFO Generating class 'XNewsItem'.

    INFO generator run took 1.00 sec.

    Note

    You might get this message while generating the code: WARNING Can't build i18n message catalog. Module 'i18ndude' not found. If that is the case, read Adding i18ndude support to ArchGenXML to add internationalization support.

  4. After this, you'll see a new poxContentTypes folder inside models with a main structure like:

    poxContentTypes

    + content

    + locales

    + profiles

    + skins

    - __init__.py

    - config.py

    - configure.zcml

    - profiles.zcml

    - refresh.txt

    - setuphandlers.py

    Note

    The + preceded lines are folders and the - preceded ones are files.

There's more…

We suggest you to:

See also

  • Adding i18ndude support to ArchGenXML
主站蜘蛛池模板: 商洛市| 屯门区| 黄冈市| 博爱县| 虹口区| 岑巩县| 克什克腾旗| 平顺县| 友谊县| 信阳市| 梧州市| 扶风县| 综艺| 闻喜县| 于都县| 沙洋县| 久治县| 望城县| 陆丰市| 定陶县| 张家港市| 贵南县| 防城港市| 岳普湖县| 宣武区| 榆林市| 海丰县| 昌乐县| 铜鼓县| 鄂伦春自治旗| 正阳县| 襄城县| 鄂伦春自治旗| 栾城县| 嘉峪关市| 永平县| 连南| 金川县| 星子县| 康保县| 云安县|