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

def Formulator::Field::Field::get_value (   self,
  id,
  kw 
) [inherited]

Get value for id.

Optionally pass keyword arguments that get passed to TALES
expression.

Definition at line 98 of file Field.py.

00098                                  :
        """Get value for id.

        Optionally pass keyword arguments that get passed to TALES
        expression.
        """
        tales_expr = self.tales.get(id, "")

        if tales_expr:
            # For some reason, path expressions expect 'here' and 'request'
            # to exist, otherwise they seem to fail. python expressions
            # don't seem to have this problem.

            # add 'here' if not in kw
            if not kw.has_key('here'):
                kw['here'] = self.aq_parent
            kw['request'] = self.REQUEST
            kw['modules'] = SecureModuleImporter
            value = tales_expr.__of__(self)(
                field=self,
                form=self.aq_parent, **kw)
        else:
            override = self.overrides.get(id, "")
            if override:
                # call wrapped method to get answer
                value = override.__of__(self)()
            else:
                # get normal value
                value = self.get_orig_value(id)

        # if normal value is a callable itself, wrap it
        if callable(value):
            return value.__of__(self)

        # create message id for title and description in right domain
        if id in ['title', 'description']:
            i18n_domain = self.get_i18n_domain()
            if i18n_domain:
                return MessageIDFactory(i18n_domain)(value)
        return value

    # this also works if field is not in form for testing
    # reasons..
    def get_i18n_domain(self):


Generated by  Doxygen 1.6.0   Back to index