[Grok-dev] Help on functional doctest for List component

Kris Degryse Kris.Degryse at traficon.com
Tue Oct 13 03:44:24 EDT 2009

Hi Christian,

As you asked, I send you the Form and interface code:
class AddCandidateForm(grok.AddForm):
    form_fields = grok.AutoFields(ICandidate)

    @grok.action('Add Candidate')
    def Add(self, **data):
        cnd = component.createObject(u'arts.models.Candidate')
        self.applyData(cnd, **data)
        self.redirect(self.url(cnd) )

class ICandidate(Interface):
    video = schema.Choice(title=u'Video'
                           , description=u'What video sequence is this candidate for?'
                           , required = True
                           , source=sources.VideoSource())
    data_types = schema.List(title=u'Data Type(s)'
                           , description=u'What type(s) of data does this candidate contain?'
                           , required = True
    data_format = schema.Choice(title=u'Data Format'
                           , description=u'What is the format of the data?'
                           , required = True
                           , source=sources.DataFormatSource())
    file = schema.Bytes(title=u'Candidate File'
                           , description=u'The File containing the data'
                           , required = True)
    platform = schema.Choice(title=u'Hardware Platform'
                           , description=u'What Hardware Platform was this test run on?'
                           , required = True
                           , source=sources.PlatformSource())
    board = schema.TextLine(title=u'hardware ID')

The "*Data Type(s)" label could not be looked up as you can see in the error message:
File "c:\clearcase\kdg_view_art\qualitycontrol\art_server\src\arts\all_tests\products_doctest.txt",
line 278, in products_doctest.txt
Failed example:
    browser.getControl('*Data Type(s)').value = ['Inverse Directions',]
Exception raised:
    Traceback (most recent call last):
      File "c:\documents and settings\kdg\.buildout\eggs\zope.testing-3.6.0-py2.5.egg\zope\testing\d
octest.py", line 1356, in __run
        compileflags, 1) in test.globs
      File "<doctest products_doctest.txt[74]>", line 1, in <module>
        browser.getControl('*Data Type(s)').value = ['Inverse Directions',]
      File "c:\documents and settings\kdg\.buildout\eggs\zope.testbrowser-3.4.2-py2.5.egg\zope\testb
rowser\browser.py", line 337, in getControl
        control, form = disambiguate(intermediate, msg, index)
      File "c:\documents and settings\kdg\.buildout\eggs\zope.testbrowser-3.4.2-py2.5.egg\zope\testb
rowser\browser.py", line 50, in disambiguate
        raise LookupError(msg)
    LookupError: label '*Data Type(s)'

Any idea to make a selection for the '*Data Type(s)' control?

Best regards,
Kris Degryse
R&D Test Engineer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20091013/c1d5f2bb/attachment.html 

More information about the Grok-dev mailing list