Commit b417aa72 by aa.gusti

Merge branch '5.0.3' into '5.0.3-oracle'

Migrasi ke deform 3

See merge request !11
2 parents f078cc11 dc7ed464
from pyramid.csrf import new_csrf_token, get_csrf_token
from iso8601.iso8601 import ISO8601_REGEX
from deform.widget import string_types
# from deform.widget import string_types
import json
import logging
from colander import SchemaNode, null, Mapping, Invalid # , string_types
# from colander import compat # tidak ada di colander 2.0
from deform import widget
from deform.compat import sequence_types, text_type, text_
# from deform.compat import sequence_types, text_type, text_
from deform.form import Button
from deform.i18n import _
from deform.widget import (
......@@ -257,12 +257,12 @@ class AutocompleteMsInputWidget(AutocompleteInputWidget):
readonly = kw.get("readonly", self.readonly)
options = {}
if isinstance(self.values, string_types):
if isinstance(self.values, str):
options["remote"] = "%s?term=%%QUERY" % self.values
else:
# vals = []
# for v in self.values:
# if not isinstance(v, string_types):
# if not isinstance(v, str):
# vals.append(v[1])
# if not vals:
# vals = self.values
......@@ -394,7 +394,7 @@ class CaptchaWidget(Widget):
def deserialize(self, field, pstruct):
if pstruct is null:
return null
elif not isinstance(pstruct, string_types):
elif not isinstance(pstruct, str):
raise Invalid(field.schema, "Pstruct is not a string")
if self.strip:
pstruct = pstruct.strip()
......@@ -460,7 +460,7 @@ class ImageWidget(Widget):
def deserialize(self, field, pstruct):
if pstruct is null:
return null
elif not isinstance(pstruct, string_types):
elif not isinstance(pstruct, str):
raise Invalid(field.schema, "Pstruct is not a string")
if self.strip:
pstruct = pstruct.strip()
......@@ -540,7 +540,7 @@ class MapWidget(Widget):
def deserialize(self, field, pstruct):
if pstruct is null:
return null
elif not isinstance(pstruct, string_types):
elif not isinstance(pstruct, str):
raise Invalid(field.schema, "Pstruct is not a string")
if self.strip:
pstruct = pstruct.strip()
......@@ -622,7 +622,7 @@ class MapWidget(Widget):
# def deserialize(self, field, pstruct):
# if pstruct is null:
# return null
# elif not isinstance(pstruct, string_types):
# elif not isinstance(pstruct, str):
# raise Invalid(field.schema, "Pstruct is not a string")
# if self.strip:
# pstruct = pstruct.strip()
......@@ -834,7 +834,7 @@ class TextInputWidget(widget.TextInputWidget):
def __init__(self, **kw):
super(TextInputWidget, self).__init__(**kw)
# if isinstance(self.button, compat.string_types):
# if isinstance(self.button, compat.str):
if self.button:
if isinstance(self.button, str):
self.button = Button(self.button, type="button")
......@@ -973,7 +973,7 @@ class FilterWidget(Widget):
# readonly = kw.get("readonly", self.readonly)
#
# options = {}
# if isinstance(self.values, string_types):
# if isinstance(self.values, str):
# options["remote"] = "%s?term=%%QUERY" % self.values
# else:
# options["local"] = self.values
......@@ -1003,7 +1003,7 @@ class CSRFWidget(widget.HiddenWidget):
cstruct = get_csrf_token(request)
if pstruct is null:
return null
elif not isinstance(pstruct, string_types):
elif not isinstance(pstruct, str):
raise Invalid(field.schema, "Pstruct is not a string")
if not pstruct:
return null
......
......@@ -6,13 +6,17 @@ import re
import colander
# import deform
from deform import compat, widget as deform_widget, field
from deform import widget as deform_widget, field # compat,
from . import widget
log = logging.getLogger(__name__)
sequence_types = (
list,
tuple,
range,
)
class DeTable(field.Field):
"""
Field representing an entire form.
......@@ -219,7 +223,7 @@ class DeTable(field.Field):
_scripts = []
# buttons = Params Buttons
for button in buttons:
if isinstance(button, compat.string_types):
if isinstance(button, str):
button = Button(button)
obj_buttons.append(button)
header_buttons = []
......
......@@ -16,10 +16,10 @@ from iso8601.iso8601 import ISO8601_REGEX
from translationstring import TranslationString
from deform.widget import MappingWidget
from deform.compat import text_
# from deform.compat import text_
from .i18n import _
_BLANK = text_("")
_BLANK = ""
class TableWidget(MappingWidget):
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!