Logo Search packages:      
Sourcecode: zope-atextensions version File versions  Download package

def ATExtensions::field::record::RecordField::getVocabularyFor (   self,
  instance = None 

the vocabulary (DisplayList) for the subfield

Definition at line 110 of file record.py.

00110                                                        :
        """the vocabulary (DisplayList) for the subfield"""
        ## XXX rr: couldn't we just rely on the field's
        ## Vocabulary method here?
        value = None
        vocab = self.subfield_vocabularies.get(subfield, None)
        if not vocab:
            raise AttributeError, 'no vocabulary found for %s' %subfield

        if isinstance(vocab, DisplayList):
            return vocab
        if type(vocab) in StringTypes:
            value = None
            method = getattr(self, vocab, None)
            if method and callable(method):
                value = method(instance)
                if instance is not None:
                    method = getattr(instance, vocab, None)
                    if method and callable(method):
                        value = method()
            if not isinstance(value, DisplayList):
                raise TypeError, '%s is not a DisplayList %s' %(value, subfield)
            return value
        raise TypeError, '%s niether a StringType or a DisplayList for %s' %(vocab, subfield)

    def getViewFor(self, instance, subfield, joinWith=', '):

Generated by  Doxygen 1.6.0   Back to index