コード例 #1
0
ファイル: textbox.py プロジェクト: marticongost/cocktail
    def _ready(self):

        value = self.value
        spellcheck = self.spellcheck

        if self.member:
            try:
                value = serialize_parameter(self.member, value)
            except:
                pass

            if self.member.required == True:
                self["required"] = True

            format = getattr(self.member, "format", None)
            if format:
                self["pattern"] = format.pattern

            # Limit the length of the control
            if isinstance(self.member, String) \
            and self.member.max is not None:
                self["maxlength"] = str(self.member.max)

            if spellcheck is None:
                spellcheck = self.member.spellcheck

        if spellcheck:
            self["spellcheck"] = True

        self["value"] = value
        Element._ready(self)
コード例 #2
0
ファイル: textarea.py プロジェクト: marticongost/cocktail
    def _ready(self):

        value = self.value
        spellcheck = self.spellcheck

        if self.member:
            try:
                value = serialize_parameter(self.member, value)
            except:
                pass

            if self.member.required == True:
                self["required"] = True

            format = getattr(self.member, "format", None)
            if format:
                self["pattern"] = format.pattern

            if spellcheck is None:
                spellcheck = self.member.spellcheck

        if spellcheck == False:
            self["spellcheck"] = False

        if value:
            self.append(value)

        Element._ready(self)
コード例 #3
0
ファイル: hiddeninput.py プロジェクト: marticongost/cocktail
    def _ready(self):

        value = self.value

        if self.member:
            try:
                value = serialize_parameter(self.member, value)
            except:
                pass

        self["value"] = value
        Element._ready(self)
コード例 #4
0
    def get_item_value(self, item):

        if item is None and self.empty_value is not None:
            return self.empty_value

        member = (
            self.member and
            (isinstance(self.member, schema.Collection) and self.member.items)
            or self.member)

        if member:
            try:
                return serialize_parameter(member, item)
            except:
                pass

        return getattr(item, "id", None) or str(item)
コード例 #5
0
 def get_entry_value(self, item):
     return serialize_parameter(self.member, item)