[BlueBream] Tutorial Section 5.6.4

Paul Harouff pharouff at gmail.com
Wed Mar 3 17:19:46 EST 2010


On Wed, Mar 3, 2010 at 4:03 PM, Paul Harouff <pharouff at gmail.com> wrote:
> Where is this second block of code for marker interfaces supposed to go in?
>
> [Note: I use csdb instead of ticketcollector, csdbDataCollector
> (schema for 18 data fields) instead of ICollector (just name and
> description). Otherwise the code should be identical to the tutorial.]
>
> [code]
> 11<class class=".csdb.Collector">
> 12  <implements
> 13     interface="zope.annotation.interfaces.IAttributeAnnotatable"
> 14     />
> 15  <implements
> 16     interface="zope.container.interfaces.IContentContainer"
> 17     />
> 18  <require
> 19     permission="zope.ManageContent"
> 20     interface=".interfaces.csdbDataCollector"
> 21     />
> 22  <require
> 23     permission="zope.ManageContent"
> 24     set_schema=".interfaces.csdbDataCollector"
> 25     />
> 26</class>
> [/code]
>
> I put it in csdb.py and got
>
> ZopeXMLConfigurationError:: File "...\configure.zcml", Line 21.4-26.10
> SyntaxError: invalid syntax (csdb.py, line 30)
>
>
> I put it in interfaces.py and got
>
> ZopeXMLConfigurationError:: File "...\configure.zcml", Line 6.4-9.10
> SyntaxError: invalid syntax (interfaces.py, line 142)
>
>
> I put it in configure.zcml and got
>
> ZopeXMLConfigurationError:: File "...\configure.zcml", Line 11.5
> ImportError: No module named tc.main.interfaces
>


I found the typo in csdb.py that was causing this error. Now I get the error

ConfigurationError: ('Invalid value for', 'class', 'ImportError:
Module csdb.main.views has no global RootDefaultView')


> I don't understand what this section of the tutorial is trying to do.
> Where does this code go? I looked at every file in the main folder and
> don't see any file that uses "<class" (i.e., a less than sign with
> class tag)
>
> Paul
>

=================
Contents of views.py

[code]
from zope.container.interfaces import INameChooser
from zope.formlib import form

from interfaces import csdbDataCollector

from csdb import Collector

class AddDataCollector(form.AddForm):

    form_fields = form.Fields(csdbDataCollector)

    def createAndAdd(self, data):
        mic = data.get('mic')
        sdc = data.get('sdc')
        sys = data.get('sys')
        subsys = data.get('subsys')
        subsubsys = data.get('subsubsys')
        assy = data.get('assy')
        disassy = data.get('disassy')
        dcv = data.get('dcv')
        manufcage = data.get('manufcage')
        partno = data.get('partno')
        partnomen = data.get('partnomen')
        infocode = data.get('infocode')
        icv = data.get('icv')
        loc = data.get('loc')
        authorcage = data.get('authorcage')
        infono = data.get('infono')
        infonomen = data.get('infonomen')
        xmlcontent = data.get('xmlcontent')
        namechooser = INameChooser(self.context)
        collector = Collector()
        collector.name = mic + "-" + sdc + "-" + sys + "-" + subsys +
subsubsys + "-" + assy + "-" + disassy + dcv + "-" + infocode + icv +
"-" + loc
        collector.description = partnomen + " - " + infonomen
        name = namechooser.chooseName(name, collector)
        self.context[name] = collector
        self.request.response.redirect(".")
[/code]


More information about the bluebream mailing list