Commit 493cccd5 by aa.gusti

colander

1 parent a1d8bd21
Showing 51 changed files with 0 additions and 5414 deletions
# coding=utf-8
import datetime
import decimal
import functools
import time
import itertools
import pprint
import re
import translationstring
import warnings
import types
from .compat import (
text_,
text_type,
string_types,
xrange,
is_nonstr_iter,
)
from . import iso8601
_ = translationstring.TranslationStringFactory('colander')
class _required(object):
""" Represents a required value in colander-related operations. """
def __repr__(self):
return '<colander.required>'
required = _required()
_marker = required # bw compat
class _null(object):
""" Represents a null value in colander-related operations. """
def __nonzero__(self):
return False
# py3 compat
__bool__ = __nonzero__
def __repr__(self):
return '<colander.null>'
def __reduce__(self):
return 'null' # when unpickled, refers to "null" below (singleton)
null = _null()
class _drop(object):
""" Represents a value that will be dropped from the schema if it
is missing during *serialization* or *deserialization*. Passed as
a value to the `missing` or `default` keyword argument
of :class:`SchemaNode`.
"""
def __repr__(self):
return '<colander.drop>'
drop = _drop()
def interpolate(msgs):
for s in msgs:
if hasattr(s, 'interpolate'):
yield s.interpolate()
else:
yield s
class UnboundDeferredError(Exception):
"""
An exception raised by :meth:`SchemaNode.deserialize` when an attempt
is made to deserialize a node which has an unbound :class:`deferred`
validator.
"""
class Invalid(Exception):
"""
An exception raised by data types and validators indicating that
the value for a particular node was not valid.
The constructor receives a mandatory ``node`` argument. This must
be an instance of the :class:`colander.SchemaNode` class, or at
least something with the same interface.
The constructor also receives an optional ``msg`` keyword
argument, defaulting to ``None``. The ``msg`` argument is a
freeform field indicating the error circumstance.
The constructor additionally may receive an optional ``value``
keyword, indicating the value related to the error.
"""
pos = None
positional = False
def __init__(self, node, msg=None, value=None):
Exception.__init__(self, node, msg)
self.node = node
self.msg = msg
self.value = value
self.children = []
def messages(self):
""" Return an iterable of error messages for this exception using the
``msg`` attribute of this error node. If the ``msg`` attribute is
iterable, it is returned. If it is not iterable, and is
non-``None``, a single-element list containing the ``msg`` value is
returned. If the value is ``None``, an empty list is returned."""
if is_nonstr_iter(self.msg):
return self.msg
if self.msg is None:
return []
return [self.msg]
def add(self, exc, pos=None):
""" Add a child exception; ``exc`` must be an instance of
:class:`colander.Invalid` or a subclass.
``pos`` is a value important for accurate error reporting. If
it is provided, it must be an integer representing the
position of ``exc`` relative to all other subexceptions of
this exception node. For example, if the exception being
added is about the third child of the exception which is
``self``, ``pos`` might be passed as ``3``.
If ``pos`` is provided, it will be assigned to the ``pos``
attribute of the provided ``exc`` object.
"""
if self.node and isinstance(self.node.typ, Positional):
exc.positional = True
if pos is not None:
exc.pos = pos
self.children.append(exc)
def __setitem__(self, name, msg):
""" Add a subexception related to a child node with the
message ``msg``. ``name`` must be present in the names of the
set of child nodes of this exception's node; if this is not
so, a :exc:`KeyError` is raised.
For example, if the exception upon which ``__setitem__`` is
called has a node attribute, and that node attribute has
children that have the names ``name`` and ``title``, you may
successfully call ``__setitem__('name', 'Bad name')`` or
``__setitem__('title', 'Bad title')``. But calling
``__setitem__('wrong', 'whoops')`` will result in a
:exc:`KeyError`.
This method is typically only useful if the ``node`` attribute
of the exception upon which it is called is a schema node
representing a mapping.
"""
for num, child in enumerate(self.node.children):
if child.name == name:
exc = Invalid(child, msg)
self.add(exc, num)
return
raise KeyError(name)
def paths(self):
""" A generator which returns each path through the exception
graph. Each path is represented as a tuple of exception
nodes. Within each tuple, the leftmost item will represent
the root schema node, the rightmost item will represent the
leaf schema node."""
def traverse(node, stack):
stack.append(node)
if not node.children:
yield tuple(stack)
for child in node.children:
for path in traverse(child, stack):
yield path
stack.pop()
return traverse(self, [])
def _keyname(self):
if self.positional:
return str(self.pos)
return str(self.node.name)
def asdict(self, translate=None, separator='; '):
""" Return a dictionary containing a basic
(non-language-translated) error report for this exception.
If ``translate`` is supplied, it must be a callable taking a
translation string as its sole argument and returning a localized,
interpolated string.
If ``separator`` is supplied, error messages are joined with that.
"""
paths = self.paths()
errors = {}
for path in paths:
keyparts = []
msgs = []
for exc in path:
exc.msg and msgs.extend(exc.messages())
keyname = exc._keyname()
keyname and keyparts.append(keyname)
if translate:
msgs = [translate(msg) for msg in msgs]
msgs = interpolate(msgs)
if separator:
msgs = separator.join(msgs)
else:
msgs = list(msgs)
errors['.'.join(keyparts)] = msgs
return errors
def __str__(self):
""" Return a pretty-formatted string representation of the
result of an execution of this exception's ``asdict`` method"""
return pprint.pformat(self.asdict())
class UnsupportedFields(Invalid):
"""
Exception used when schema object detect unknown fields in the
cstruct during deserialize.
"""
def __init__(self, node, fields, msg=None):
super(UnsupportedFields, self).__init__(node, msg)
self.fields = fields
class All(object):
""" Composite validator which succeeds if none of its
subvalidators raises an :class:`colander.Invalid` exception"""
def __init__(self, *validators):
self.validators = validators
def __call__(self, node, value):
excs = []
for validator in self.validators:
try:
validator(node, value)
except Invalid as e:
excs.append(e)
if excs:
exc = Invalid(node, [exc.msg for exc in excs])
for e in excs:
exc.children.extend(e.children)
raise exc
class Any(All):
""" Composite validator which succeeds if at least one of its
subvalidators does not raise an :class:`colander.Invalid` exception."""
def __call__(self, node, value):
try:
return super(Any, self).__call__(node, value)
except Invalid as e:
if len(e.msg) < len(self.validators):
# At least one validator did not fail:
return
raise
class Function(object):
""" Validator which accepts a function and an optional message;
the function is called with the ``value`` during validation.
If the function returns anything falsy (``None``, ``False``, the
empty string, ``0``, an object with a ``__nonzero__`` that returns
``False``, etc) when called during validation, an
:exc:`colander.Invalid` exception is raised (validation fails);
its msg will be the value of the ``msg`` argument passed to this
class' constructor.
If the function returns a stringlike object (a ``str`` or
``unicode`` object) that is *not* the empty string , a
:exc:`colander.Invalid` exception is raised using the stringlike
value returned from the function as the exeption message
(validation fails).
If the function returns anything *except* a stringlike object
object which is truthy (e.g. ``True``, the integer ``1``, an
object with a ``__nonzero__`` that returns ``True``, etc), an
:exc:`colander.Invalid` exception is *not* raised (validation
succeeds).
The default value for the ``msg`` when not provided via the
constructor is ``Invalid value``.
The ``message`` parameter has been deprecated, use ``msg`` instead.
"""
def __init__(self, function, msg=None, message=None):
self.function = function
if msg is not None and message is not None:
raise ValueError('Only one of msg and message can be passed')
# Handle bw compat
if msg is None and message is None:
msg = _('Invalid value')
elif message is not None:
warnings.warn(
'The "message" argument has been deprecated, use "msg" '
'instead.',
DeprecationWarning
)
msg = message
self.msg = msg
def __call__(self, node, value):
result = self.function(value)
if not result:
raise Invalid(
node, translationstring.TranslationString(
self.msg, mapping={'val':value}))
if isinstance(result, string_types):
raise Invalid(
node, translationstring.TranslationString(
result, mapping={'val':value}))
class Regex(object):
""" Regular expression validator.
Initialize it with the string regular expression ``regex`` that will
be compiled and matched against ``value`` when validator is called. It
uses Python's :py:func:`re.match`, which only matches at the beginning
of the string and not at the beginning of each line. To match the
entire string, enclose the regular expression with ``^`` and ``$``.
If ``msg`` is supplied, it will be the error message to be used;
otherwise, defaults to 'String does not match expected pattern'.
The ``regex`` expression behaviour can be modified by specifying
any ``flags`` value taken by ``re.compile``.
The ``regex`` argument may also be a pattern object (the
result of ``re.compile``) instead of a string.
When calling, if ``value`` matches the regular expression,
validation succeeds; otherwise, :exc:`colander.Invalid` is
raised with the ``msg`` error message.
"""
def __init__(self, regex, msg=None, flags=0):
if isinstance(regex, string_types):
self.match_object = re.compile(regex, flags)
else:
self.match_object = regex
if msg is None:
self.msg = _("String does not match expected pattern")
else:
self.msg = msg
def __call__(self, node, value):
if self.match_object.match(value) is None:
raise Invalid(node, self.msg)
EMAIL_RE = "(?i)^[A-Z0-9._%!#$%&'*+-/=?^_`{|}~()]+@[A-Z0-9]+([.-][A-Z0-9]+)*\.[A-Z]{2,22}$"
class Email(Regex):
""" Email address validator. If ``msg`` is supplied, it will be
the error message to be used when raising :exc:`colander.Invalid`;
otherwise, defaults to 'Invalid email address'.
"""
def __init__(self, msg=None):
email_regex = text_(EMAIL_RE)
if msg is None:
msg = _("Invalid email address")
super(Email, self).__init__(email_regex, msg=msg)
class Range(object):
""" Validator which succeeds if the value it is passed is greater
or equal to ``min`` and less than or equal to ``max``. If ``min``
is not specified, or is specified as ``None``, no lower bound
exists. If ``max`` is not specified, or is specified as ``None``,
no upper bound exists.
``min_err`` is used to form the ``msg`` of the
:exc:`colander.Invalid` error when reporting a validation failure
caused by a value not meeting the minimum. If ``min_err`` is
specified, it must be a string. The string may contain the
replacement targets ``${min}`` and ``${val}``, representing the
minimum value and the provided value respectively. If it is not
provided, it defaults to ``'${val} is less than minimum value
${min}'``.
``max_err`` is used to form the ``msg`` of the
:exc:`colander.Invalid` error when reporting a validation failure
caused by a value exceeding the maximum. If ``max_err`` is
specified, it must be a string. The string may contain the
replacement targets ``${max}`` and ``${val}``, representing the
maximum value and the provided value respectively. If it is not
provided, it defaults to ``'${val} is greater than maximum value
${max}'``.
"""
_MIN_ERR = _('${val} is less than minimum value ${min}')
_MAX_ERR = _('${val} is greater than maximum value ${max}')
def __init__(self, min=None, max=None, min_err=_MIN_ERR, max_err=_MAX_ERR):
self.min = min
self.max = max
self.min_err = min_err
self.max_err = max_err
def __call__(self, node, value):
if self.min is not None:
if value < self.min:
min_err = _(
self.min_err, mapping={'val':value, 'min':self.min})
raise Invalid(node, min_err)
if self.max is not None:
if value > self.max:
max_err = _(
self.max_err, mapping={'val':value, 'max':self.max})
raise Invalid(node, max_err)
class Length(object):
"""Validator which succeeds if the value passed to it has a
length between a minimum and maximum, expressed in the
optional ``min`` and ``max`` arguments.
The value can be any sequence, most often a string.
If ``min`` is not specified, or is specified as ``None``,
no lower bound exists. If ``max`` is not specified, or
is specified as ``None``, no upper bound exists.
The default error messages are "Shorter than minimum length ${min}"
and "Longer than maximum length ${max}". These can be customized:
``min_err`` is used to form the ``msg`` of the
:exc:`colander.Invalid` error when reporting a validation failure
caused by a value not meeting the minimum length. If ``min_err`` is
specified, it must be a string. The string may contain the
replacement target ``${min}``.
``max_err`` is used to form the ``msg`` of the
:exc:`colander.Invalid` error when reporting a validation failure
caused by a value exceeding the maximum length. If ``max_err`` is
specified, it must be a string. The string may contain the
replacement target ``${max}``.
"""
_MIN_ERR = _('Shorter than minimum length ${min}')
_MAX_ERR = _('Longer than maximum length ${max}')
def __init__(self, min=None, max=None, min_err=_MIN_ERR, max_err=_MAX_ERR):
self.min = min
self.max = max
self.min_err = min_err
self.max_err = max_err
def __call__(self, node, value):
if self.min is not None:
if len(value) < self.min:
min_err = _(self.min_err, mapping={'min': self.min})
raise Invalid(node, min_err)
if self.max is not None:
if len(value) > self.max:
max_err = _(self.max_err, mapping={'max': self.max})
raise Invalid(node, max_err)
class OneOf(object):
""" Validator which succeeds if the value passed to it is one of
a fixed set of values """
def __init__(self, choices):
self.choices = choices
def __call__(self, node, value):
if not value in self.choices:
choices = ', '.join(['%s' % x for x in self.choices])
err = _('"${val}" is not one of ${choices}',
mapping={'val':value, 'choices':choices})
raise Invalid(node, err)
class NoneOf(object):
""" Validator which succeeds if the value passed to it is none of a
fixed set of values.
``msg_err`` is used to form the ``msg`` of the :exc:`colander.Invalid`
error when reporting a validation failure. If ``msg_err`` is specified,
it must be a string. The string may contain the replacement targets
``${choices}`` and ``${val}``, representing the set of forbidden values
and the provided value respectively.
"""
_MSG_ERR = _('"${val}" must not be one of ${choices}')
def __init__(self, choices, msg_err=_MSG_ERR):
self.forbidden = choices
self.msg_err = msg_err
def __call__(self, node, value):
if value not in self.forbidden:
return
choices = ', '.join(['%s' % x for x in self.forbidden])
err = _(self.msg_err, mapping={'val': value, 'choices': choices})
raise Invalid(node, err)
class ContainsOnly(object):
""" Validator which succeeds if the value passed to is a sequence and each
element in the sequence is also in the sequence passed as ``choices``.
This validator is useful when attached to a schemanode with, e.g. a
:class:`colander.Set` or another sequencetype.
"""
err_template = _(
'One or more of the choices you made was not acceptable'
)
def __init__(self, choices):
self.choices = choices
def __call__(self, node, value):
if not set(value).issubset(self.choices):
err = _(
self.err_template,
mapping = {'val':value, 'choices':self.choices}
)
raise Invalid(node, err)
def luhnok(node, value):
""" Validator which checks to make sure that the value passes a luhn
mod-10 checksum (credit cards). ``value`` must be a string, not an
integer."""
try:
sum = _luhnok(value)
except:
raise Invalid(node,
_('"${val}" is not a valid credit card number',
mapping={'val': value}))
if not (sum % 10) == 0:
raise Invalid(node,
_('"${val}" is not a valid credit card number',
mapping={'val': value}))
def _luhnok(value):
sum = 0
num_digits = len(value)
oddeven = num_digits & 1
for count in range(0, num_digits):
digit = int(value[count])
if not (( count & 1 ) ^ oddeven ):
digit = digit * 2
if digit > 9:
digit = digit - 9
sum = sum + digit
return sum
URL_REGEX = r"""(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))""" # "emacs!
url = Regex(URL_REGEX, _('Must be a URL'))
UUID_REGEX = r"""^(?:urn:uuid:)?\{?[a-f0-9]{8}(?:-?[a-f0-9]{4}){3}-?[a-f0-9]{12}\}?$"""
uuid = Regex(UUID_REGEX, _('Invalid UUID string'), re.IGNORECASE)
class SchemaType(object):
""" Base class for all schema types """
def flatten(self, node, appstruct, prefix='', listitem=False):
result = {}
if listitem:
selfname = prefix
else:
selfname = '%s%s' % (prefix, node.name)
result[selfname.rstrip('.')] = appstruct
return result
def unflatten(self, node, paths, fstruct):
name = node.name
assert paths == [name], "paths should be [name] for leaf nodes."
return fstruct[name]
def set_value(self, node, appstruct, path, value):
raise AssertionError("Can't call 'set_value' on a leaf node.")
def get_value(self, node, appstruct, path):
raise AssertionError("Can't call 'get_value' on a leaf node.")
def cstruct_children(self, node, cstruct):
return []
class Mapping(SchemaType):
""" A type which represents a mapping of names to nodes.
The subnodes of the :class:`colander.SchemaNode` that wraps
this type imply the named keys and values in the mapping.
The constructor of this type accepts one extra optional keyword
argument that other types do not: ``unknown``. An attribute of
the same name can be set on a type instance to control the
behavior after construction.
unknown
``unknown`` controls the behavior of this type when an unknown
key is encountered in the cstruct passed to the
``deserialize`` method of this instance. All the potential
values of ``unknown`` are strings. They are:
- ``ignore`` means that keys that are not present in the schema
associated with this type will be ignored during
deserialization.
- ``raise`` will cause a :exc:`colander.Invalid` exception to
be raised when unknown keys are present in the cstruct
during deserialization.
- ``preserve`` will preserve the 'raw' unknown keys and values
in the appstruct returned by deserialization.
Default: ``ignore``.
Special behavior is exhibited when a subvalue of a mapping is
present in the schema but is missing from the mapping passed to
either the ``serialize`` or ``deserialize`` method of this class.
In this case, the :attr:`colander.null` value will be passed to
the ``serialize`` or ``deserialize`` method of the schema node
representing the subvalue of the mapping respectively. During
serialization, this will result in the behavior described in
:ref:`serializing_null` for the subnode. During deserialization,
this will result in the behavior described in
:ref:`deserializing_null` for the subnode.
If the :attr:`colander.null` value is passed to the serialize
method of this class, a dictionary will be returned, where each of
the values in the returned dictionary is the serialized
representation of the null value for its type.
"""
def __init__(self, unknown='ignore'):
self.unknown = unknown
def _set_unknown(self, value):
if not value in ('ignore', 'raise', 'preserve'):
raise ValueError(
'unknown attribute must be one of "ignore", "raise", '
'or "preserve"')
self._unknown = value
def _get_unknown(self):
return self._unknown
unknown = property(_get_unknown, _set_unknown)
def _validate(self, node, value):
try:
print("**debug**", value)
if hasattr(value, 'items'):
return dict(value)
else:
raise TypeError('Does not implement dict-like functionality.')
except Exception as e:
raise Invalid(node,
_('"${val}" is not a mapping type: ${err}',
mapping = {'val':value, 'err':e})
)
def cstruct_children(self, node, cstruct):
if cstruct is null:
value = {}
else:
value = self._validate(node, cstruct)
children = []
for subnode in node.children:
name = subnode.name
subval = value.get(name, _marker)
if subval is _marker:
subval = subnode.serialize(null)
children.append(subval)
return children
def _impl(self, node, value, callback):
value = self._validate(node, value)
error = None
result = {}
for num, subnode in enumerate(node.children):
name = subnode.name
subval = value.pop(name, null)
if subval is drop or (subval is null and subnode.default is drop):
continue
try:
sub_result = callback(subnode, subval)
except Invalid as e:
if error is None:
error = Invalid(node)
error.add(e, num)
else:
if sub_result is drop:
continue
result[name] = sub_result
if self.unknown == 'raise':
if value:
raise UnsupportedFields(
node, value,
msg=_('Unrecognized keys in mapping: "${val}"',
mapping={'val': value}))
elif self.unknown == 'preserve':
result.update(value)
if error is not None:
raise error
return result
def serialize(self, node, appstruct):
if appstruct is null:
appstruct = {}
def callback(subnode, subappstruct):
return subnode.serialize(subappstruct)
return self._impl(node, appstruct, callback)
def deserialize(self, node, cstruct):
if cstruct is null:
return null
def callback(subnode, subcstruct):
return subnode.deserialize(subcstruct)
return self._impl(node, cstruct, callback)
def flatten(self, node, appstruct, prefix='', listitem=False):
result = {}
if listitem:
selfprefix = prefix
else:
if node.name:
selfprefix = '%s%s.' % (prefix, node.name)
else:
selfprefix = prefix
for subnode in node.children:
name = subnode.name
substruct = appstruct.get(name, null)
result.update(subnode.typ.flatten(subnode, substruct,
prefix=selfprefix))
return result
def unflatten(self, node, paths, fstruct):
return _unflatten_mapping(node, paths, fstruct)
def set_value(self, node, appstruct, path, value):
if '.' in path:
next_name, rest = path.split('.', 1)
next_node = node[next_name]
next_appstruct = appstruct[next_name]
appstruct[next_name] = next_node.typ.set_value(
next_node, next_appstruct, rest, value)
else:
appstruct[path] = value
return appstruct
def get_value(self, node, appstruct, path):
if '.' in path:
name, rest = path.split('.', 1)
next_node = node[name]
return next_node.typ.get_value(next_node, appstruct[name], rest)
return appstruct[path]
class Positional(object):
"""
Marker abstract base class meaning 'this type has children which
should be addressed by position instead of name' (e.g. via seq[0],
but never seq['name']). This is consulted by Invalid.asdict when
creating a dictionary representation of an error tree.
"""
class Tuple(Positional, SchemaType):
""" A type which represents a fixed-length sequence of nodes.
The subnodes of the :class:`colander.SchemaNode` that wraps
this type imply the positional elements of the tuple in the order
they are added.
This type is willing to serialize and deserialized iterables that,
when converted to a tuple, have the same number of elements as the
number of the associated node's subnodes.
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value will be
returned.
"""
def _validate(self, node, value):
if not hasattr(value, '__iter__'):
raise Invalid(
node,
_('"${val}" is not iterable', mapping={'val':value})
)
valuelen, nodelen = len(value), len(node.children)
if valuelen != nodelen:
raise Invalid(
node,
_('"${val}" has an incorrect number of elements '
'(expected ${exp}, was ${was})',
mapping={'val':value, 'exp':nodelen, 'was':valuelen})
)
return list(value)
def cstruct_children(self, node, cstruct):
childlen = len(node.children)
if cstruct is null:
cstruct = []
structlen = len(cstruct)
if structlen < childlen:
missing_children = node.children[structlen:]
cstruct = list(cstruct)
for child in missing_children:
cstruct.append(child.serialize(null))
elif structlen > childlen:
cstruct = cstruct[:childlen]
else:
cstruct = list(cstruct)
return cstruct
def _impl(self, node, value, callback):
value = self._validate(node, value)
error = None
result = []
for num, subnode in enumerate(node.children):
subval = value[num]
try:
result.append(callback(subnode, subval))
except Invalid as e:
if error is None:
error = Invalid(node)
error.add(e, num)
if error is not None:
raise error
return tuple(result)
def serialize(self, node, appstruct):
if appstruct is null:
return null
def callback(subnode, subappstruct):
return subnode.serialize(subappstruct)
return self._impl(node, appstruct, callback)
def deserialize(self, node, cstruct):
if cstruct is null:
return null
def callback(subnode, subval):
return subnode.deserialize(subval)
return self._impl(node, cstruct, callback)
def flatten(self, node, appstruct, prefix='', listitem=False):
result = {}
if listitem:
selfprefix = prefix
else:
selfprefix = '%s%s.' % (prefix, node.name)
for num, subnode in enumerate(node.children):
substruct = appstruct[num]
result.update(subnode.typ.flatten(subnode, substruct,
prefix=selfprefix))
return result
def unflatten(self, node, paths, fstruct):
mapstruct = _unflatten_mapping(node, paths, fstruct)
appstruct = []
for subnode in node.children:
appstruct.append(mapstruct[subnode.name])
return tuple(appstruct)
def set_value(self, node, appstruct, path, value):
appstruct = list(appstruct)
if '.' in path:
next_name, rest = path.split('.', 1)
else:
next_name, rest = path, None
for index, next_node in enumerate(node.children):
if next_node.name == next_name:
break
else:
raise KeyError(next_name)
if rest is not None:
next_appstruct = appstruct[index]
appstruct[index] = next_node.typ.set_value(
next_node, next_appstruct, rest, value)
else:
appstruct[index] = value
return tuple(appstruct)
def get_value(self, node, appstruct, path):
if '.' in path:
name, rest = path.split('.', 1)
else:
name, rest = path, None
for index, next_node in enumerate(node.children):
if next_node.name == name:
break
else:
raise KeyError(name)
if rest is not None:
return next_node.typ.get_value(next_node, appstruct[index], rest)
return appstruct[index]
class Set(SchemaType):
""" A type representing a non-overlapping set of items.
Deserializes an iterable to a ``set`` object.
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value will be
returned.
.. versionadded: 1.0a1
"""
def serialize(self, node, appstruct):
if appstruct is null:
return null
return appstruct
def deserialize(self, node, cstruct):
if cstruct is null:
return null
if not is_nonstr_iter(cstruct):
raise Invalid(
node,
_('${cstruct} is not iterable', mapping={'cstruct': cstruct})
)
return set(cstruct)
class List(SchemaType):
""" Type representing an ordered sequence of items.
Desrializes an iterable to a ``list`` object.
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value will be
returned.
.. versionadded: 1.0a6
"""
def serialize(self, node, appstruct):
if appstruct is null:
return null
return appstruct
def deserialize(self, node, cstruct):
if cstruct is null:
return null
if not is_nonstr_iter(cstruct):
raise Invalid(
node,
_('${cstruct} is not iterable', mapping={'cstruct': cstruct})
)
return list(cstruct)
class SequenceItems(list):
"""
List marker subclass for use by Sequence.cstruct_children, which indicates
to a caller of that method that the result is from a sequence type.
Usually these values need to be treated specially, because all of the
children of a Sequence are not present in a schema.
"""
class Sequence(Positional, SchemaType):
"""
A type which represents a variable-length sequence of nodes,
all of which must be of the same type.
The type of the first subnode of the
:class:`colander.SchemaNode` that wraps this type is considered the
sequence type.
The optional ``accept_scalar`` argument to this type's constructor
indicates what should happen if the value found during serialization or
deserialization does not have an ``__iter__`` method or is a
mapping type.
If ``accept_scalar`` is ``True`` and the value does not have an
``__iter__`` method or is a mapping type, the value will be turned
into a single element list.
If ``accept_scalar`` is ``False`` and the value does not have an
``__iter__`` method or is a mapping type, an
:exc:`colander.Invalid` error will be raised during serialization
and deserialization.
The default value of ``accept_scalar`` is ``False``.
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value is returned.
"""
def __init__(self, accept_scalar=False):
self.accept_scalar = accept_scalar
def _validate(self, node, value, accept_scalar):
if (hasattr(value, '__iter__') and
not hasattr(value, 'get') and
not isinstance(value, string_types)):
return list(value)
if accept_scalar:
return [value]
else:
raise Invalid(node, _('"${val}" is not iterable',
mapping={'val':value})
)
def cstruct_children(self, node, cstruct):
if cstruct is null:
return SequenceItems([])
return SequenceItems(cstruct)
def _impl(self, node, value, callback, accept_scalar):
if accept_scalar is None:
accept_scalar = self.accept_scalar
value = self._validate(node, value, accept_scalar)
error = None
result = []
subnode = node.children[0]
for num, subval in enumerate(value):
if subval is drop or (subval is null and subnode.default is drop):
continue
try:
sub_result = callback(subnode, subval)
except Invalid as e:
if error is None:
error = Invalid(node)
error.add(e, num)
else:
if sub_result is drop:
continue
result.append(sub_result)
if error is not None:
raise error
return result
def serialize(self, node, appstruct, accept_scalar=None):
"""
Along with the normal ``node`` and ``appstruct`` arguments,
this method accepts an additional optional keyword argument:
``accept_scalar``. This keyword argument can be used to
override the constructor value of the same name.
If ``accept_scalar`` is ``True`` and the ``appstruct`` does
not have an ``__iter__`` method or is a mapping type, the
value will be turned into a single element list.
If ``accept_scalar`` is ``False`` and the ``appstruct`` does
not have an ``__iter__`` method or is a mapping type, an
:exc:`colander.Invalid` error will be raised during
serialization and deserialization.
The default of ``accept_scalar`` is ``None``, which means
respect the default ``accept_scalar`` value attached to this
instance via its constructor.
"""
if appstruct is null:
return null
def callback(subnode, subappstruct):
return subnode.serialize(subappstruct)
return self._impl(node, appstruct, callback, accept_scalar)
def deserialize(self, node, cstruct, accept_scalar=None):
"""
Along with the normal ``node`` and ``cstruct`` arguments, this
method accepts an additional optional keyword argument:
``accept_scalar``. This keyword argument can be used to
override the constructor value of the same name.
If ``accept_scalar`` is ``True`` and the ``cstruct`` does not
have an ``__iter__`` method or is a mapping type, the value
will be turned into a single element list.
If ``accept_scalar`` is ``False`` and the ``cstruct`` does not have an
``__iter__`` method or is a mapping type, an
:exc:`colander.Invalid` error will be raised during serialization
and deserialization.
The default of ``accept_scalar`` is ``None``, which means
respect the default ``accept_scalar`` value attached to this
instance via its constructor.
"""
if cstruct is null:
return null
def callback(subnode, subcstruct):
return subnode.deserialize(subcstruct)
return self._impl(node, cstruct, callback, accept_scalar)
def flatten(self, node, appstruct, prefix='', listitem=False):
result = {}
if listitem:
selfprefix = prefix
else:
selfprefix = '%s%s.' % (prefix, node.name)
childnode = node.children[0]
for num, subval in enumerate(appstruct):
subname = '%s%s' % (selfprefix, num)
subprefix = subname + '.'
result.update(childnode.typ.flatten(
childnode, subval, prefix=subprefix, listitem=True))
return result
def unflatten(self, node, paths, fstruct):
only_child = node.children[0]
child_name = only_child.name
def get_child(name):
return only_child
def rewrite_subpath(subpath):
if '.' in subpath:
suffix = subpath.split('.', 1)[1]
return '%s.%s' % (child_name, suffix)
return child_name
mapstruct = _unflatten_mapping(node, paths, fstruct,
get_child, rewrite_subpath)
return [mapstruct[str(index)] for index in xrange(len(mapstruct))]
def set_value(self, node, appstruct, path, value):
if '.' in path:
next_name, rest = path.split('.', 1)
index = int(next_name)
next_node = node.children[0]
next_appstruct = appstruct[index]
appstruct[index] = next_node.typ.set_value(
next_node, next_appstruct, rest, value)
else:
index = int(path)
appstruct[index] = value
return appstruct
def get_value(self, node, appstruct, path):
if '.' in path:
name, rest = path.split('.', 1)
index = int(name)
next_node = node.children[0]
return next_node.typ.get_value(next_node, appstruct[index], rest)
return appstruct[int(path)]
Seq = Sequence
class String(SchemaType):
""" A type representing a Unicode string.
This type constructor accepts two arguments:
``encoding``
Represents the encoding which should be applied to value
serialization and deserialization, for example ``utf-8``. If
``encoding`` is passed as ``None``, the ``serialize`` method of
this type will not do any special encoding of the appstruct it is
provided, nor will the ``deserialize`` method of this type do
any special decoding of the cstruct it is provided; inputs and
outputs will be assumed to be Unicode. ``encoding`` defaults
to ``None``.
If ``encoding`` is ``None``:
- A Unicode input value to ``serialize`` is returned untouched.
- A non-Unicode input value to ``serialize`` is run through the
``unicode()`` function without an ``encoding`` parameter
(``unicode(value)``) and the result is returned.
- A Unicode input value to ``deserialize`` is returned untouched.
- A non-Unicode input value to ``deserialize`` is run through the
``unicode()`` function without an ``encoding`` parameter
(``unicode(value)``) and the result is returned.
If ``encoding`` is not ``None``:
- A Unicode input value to ``serialize`` is run through the
``unicode`` function with the encoding parameter
(``unicode(value, encoding)``) and the result (a ``str``
object) is returned.
- A non-Unicode input value to ``serialize`` is converted to a
Unicode using the encoding (``unicode(value, encoding)``);
subsequently the Unicode object is re-encoded to a ``str``
object using the encoding and returned.
- A Unicode input value to ``deserialize`` is returned
untouched.
- A non-Unicode input value to ``deserialize`` is converted to
a ``str`` object using ``str(value``). The resulting str
value is converted to Unicode using the encoding
(``unicode(value, encoding)``) and the result is returned.
A corollary: If a string (as opposed to a unicode object) is
provided as a value to either the serialize or deserialize
method of this type, and the type also has an non-None
``encoding``, the string must be encoded with the type's
encoding. If this is not true, an :exc:`colander.Invalid`
error will result.
``allow_empty``
Boolean, if True allows deserialization of an empty string. If
False (default), empty strings will deserialize to
:attr:`colander.null`
The subnodes of the :class:`colander.SchemaNode` that wraps
this type are ignored.
"""
def __init__(self, encoding=None, allow_empty=False):
self.encoding = encoding
self.allow_empty = allow_empty
def serialize(self, node, appstruct):
if appstruct is null:
return null
try:
if isinstance(appstruct, (text_type, bytes)):
encoding = self.encoding
if encoding:
result = text_(appstruct, encoding).encode(encoding)
else:
result = text_type(appstruct)
else:
result = text_type(appstruct)
if self.encoding:
result = result.encode(self.encoding)
return result
except Exception as e:
raise Invalid(node,
_('${val} cannot be serialized: ${err}',
mapping={'val':appstruct, 'err':e})
)
def deserialize(self, node, cstruct):
if cstruct == '' and self.allow_empty:
return text_type('')
if not cstruct:
return null
try:
result = cstruct
if isinstance(result, (text_type, bytes)):
if self.encoding:
result = text_(cstruct, self.encoding)
else:
result = text_type(cstruct)
else:
raise Invalid(node)
except Exception as e:
raise Invalid(node,
_('${val} is not a string: ${err}',
mapping={'val':cstruct, 'err':e}))
return result
Str = String
class Number(SchemaType):
""" Abstract base class for float, int, decimal """
num = None
def serialize(self, node, appstruct):
if appstruct is null:
return null
try:
return str(self.num(appstruct))
except Exception:
raise Invalid(node,
_('"${val}" is not a number',
mapping={'val':appstruct}),
)
def deserialize(self, node, cstruct):
if cstruct != 0 and not cstruct:
return null
try:
return self.num(cstruct)
except Exception:
raise Invalid(node,
_('"${val}" is not a number',
mapping={'val':cstruct})
)
class Integer(Number):
""" A type representing an integer.
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value will be
returned.
The subnodes of the :class:`colander.SchemaNode` that wraps
this type are ignored.
"""
num = int
Int = Integer
class Float(Number):
""" A type representing a float.
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value will be
returned.
The subnodes of the :class:`colander.SchemaNode` that wraps
this type are ignored.
"""
num = float
class Decimal(Number):
"""
A type representing a decimal floating point. Deserialization returns an
instance of the Python ``decimal.Decimal`` type.
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value will be
returned.
The Decimal constructor takes three optional arguments, ``quant``,
``rounding`` and ``normalize``. If supplied, ``quant`` should be a string,
(e.g. ``1.00``). If supplied, ``rounding`` should be one of the Python
``decimal`` module rounding options (e.g. ``decimal.ROUND_UP``,
``decimal.ROUND_DOWN``, etc). The serialized and deserialized result
will be quantized and rounded via
``result.quantize(decimal.Decimal(quant), rounding)``. ``rounding`` is
ignored if ``quant`` is not supplied. If ``normalize`` is ``True``,
the serialized and deserialized result will be normalized by stripping
the rightmost trailing zeros.
The subnodes of the :class:`colander.SchemaNode` that wraps
this type are ignored.
"""
def __init__(self, quant=None, rounding=None, normalize=False):
if quant is None:
self.quant = None
else:
self.quant = decimal.Decimal(quant)
self.rounding = rounding
self.normalize = normalize
def num(self, val):
result = decimal.Decimal(str(val))
if self.quant is not None:
if self.rounding is None:
result = result.quantize(self.quant)
else:
result = result.quantize(self.quant, self.rounding)
if self.normalize:
result = result.normalize()
return result
class Money(Decimal):
""" A type representing a money value with two digit precision.
Deserialization returns an instance of the Python ``decimal.Decimal``
type (quantized to two decimal places, rounded up).
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value will be
returned.
The subnodes of the :class:`colander.SchemaNode` that wraps
this type are ignored.
"""
def __init__(self):
super(Money, self).__init__(decimal.Decimal('.01'), decimal.ROUND_UP)
class Boolean(SchemaType):
""" A type representing a boolean object.
The constructor accepts these keyword arguments:
- ``false_choices``: The set of strings representing a ``False``
value on deserialization.
- ``true_choices``: The set of strings representing a ``True``
value on deserialization.
- ``false_val``: The value returned on serialization of a False
value.
- ``true_val``: The value returned on serialization of a True
value.
During deserialization, a value contained in :attr:`false_choices`,
will be considered ``False``.
The behaviour for values not contained in :attr:`false_choices`
depends on :attr:`true_choices`: if it's empty, any value is considered
``True``; otherwise, only values contained in :attr:`true_choices`
are considered ``True``, and an Invalid exception would be raised
for values outside of both :attr:`false_choices` and :attr:`true_choices`.
Serialization will produce :attr:`true_val` or :attr:`false_val`
based on the value.
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value will be
returned.
The subnodes of the :class:`colander.SchemaNode` that wraps
this type are ignored.
"""
def __init__(self, false_choices=('false', '0'), true_choices=(),
false_val='false', true_val='true'):
self.false_choices = false_choices
self.true_choices = true_choices
self.false_val = false_val
self.true_val = true_val
self.true_reprs = ', '.join([repr(c) for c in self.true_choices])
self.false_reprs = ', '.join([repr(c) for c in self.false_choices])
def serialize(self, node, appstruct):
if appstruct is null:
return null
return appstruct and self.true_val or self.false_val
def deserialize(self, node, cstruct):
if cstruct is null:
return null
try:
result = str(cstruct)
except:
raise Invalid(node,
_('${val} is not a string', mapping={'val':cstruct})
)
result = result.lower()
if result in self.false_choices:
return False
elif self.true_choices:
if result in self.true_choices:
return True
else:
raise Invalid(node,
_('"${val}" is neither in (${false_choices}) '
'nor in (${true_choices})',
mapping={'val':cstruct,
'false_choices': self.false_reprs,
'true_choices': self.true_reprs })
)
return True
Bool = Boolean
class GlobalObject(SchemaType):
""" A type representing an importable Python object. This type
serializes 'global' Python objects (objects which can be imported)
to dotted Python names.
Two dotted name styles are supported during deserialization:
- ``pkg_resources``-style dotted names where non-module attributes
of a module are separated from the rest of the path using a ':'
e.g. ``package.module:attr``.
- ``zope.dottedname``-style dotted names where non-module
attributes of a module are separated from the rest of the path
using a '.' e.g. ``package.module.attr``.
These styles can be used interchangeably. If the serialization
contains a ``:`` (colon), the ``pkg_resources`` resolution
mechanism will be chosen, otherwise the ``zope.dottedname``
resolution mechanism will be chosen.
The constructor accepts a single argument named ``package`` which
should be a Python module or package object; it is used when
*relative* dotted names are supplied to the ``deserialize``
method. A serialization which has a ``.`` (dot) or ``:`` (colon)
as its first character is treated as relative. E.g. if
``.minidom`` is supplied to ``deserialize``, and the ``package``
argument to this type was passed the ``xml`` module object, the
resulting import would be for ``xml.minidom``. If a relative
package name is supplied to ``deserialize``, and no ``package``
was supplied to the constructor, an :exc:`colander.Invalid` error
will be raised.
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value will be
returned.
The subnodes of the :class:`colander.SchemaNode` that wraps
this type are ignored.
"""
def __init__(self, package):
self.package = package
def _pkg_resources_style(self, node, value):
""" package.module:attr style """
import pkg_resources
if value.startswith('.') or value.startswith(':'):
if not self.package:
raise Invalid(
node,
_('relative name "${val}" irresolveable without package',
mapping={'val':value})
)
if value in ['.', ':']:
value = self.package.__name__
else:
value = self.package.__name__ + value
return pkg_resources.EntryPoint.parse(
'x=%s' % value).load(False)
def _zope_dottedname_style(self, node, value):
""" package.module.attr style """
module = self.package and self.package.__name__ or None
if value == '.':
if self.package is None:
raise Invalid(
node,
_('relative name "${val}" irresolveable without package',
mapping={'val':value})
)
name = module.split('.')
else:
name = value.split('.')
if not name[0]:
if module is None:
raise Invalid(
node,
_('relative name "${val}" irresolveable without '
'package', mapping={'val':value})
)
module = module.split('.')
name.pop(0)
while not name[0]:
module.pop()
name.pop(0)
name = module + name
used = name.pop(0)
found = __import__(used)
for n in name:
used += '.' + n
try:
found = getattr(found, n)
except AttributeError: # pragma: no cover
__import__(used)
found = getattr(found, n)
return found
def serialize(self, node, appstruct):
if appstruct is null:
return null
try:
if isinstance(appstruct, types.ModuleType):
return appstruct.__name__
else:
return '{0.__module__}.{0.__name__}'.format(appstruct)
except AttributeError:
raise Invalid(node,
_('"${val}" has no __name__',
mapping={'val':appstruct})
)
def deserialize(self, node, cstruct):
if not cstruct:
return null
if not isinstance(cstruct, string_types):
raise Invalid(node,
_('"${val}" is not a string',
mapping={'val':cstruct}))
try:
if ':' in cstruct:
return self._pkg_resources_style(node, cstruct)
else:
return self._zope_dottedname_style(node, cstruct)
except ImportError:
raise Invalid(node,
_('The dotted name "${name}" cannot be imported',
mapping={'name':cstruct}))
class DateTime(SchemaType):
""" A type representing a Python ``datetime.datetime`` object.
This type serializes python ``datetime.datetime`` objects to a
`ISO8601 <http://en.wikipedia.org/wiki/ISO_8601>`_ string format.
The format includes the date, the time, and the timezone of the
datetime.
The constructor accepts an argument named ``default_tzinfo`` which
should be a Python ``tzinfo`` object. If ``default_tzinfo`` is not
specified the default tzinfo will be equivalent to UTC (Zulu time).
The ``default_tzinfo`` tzinfo object is used to convert 'naive'
datetimes to a timezone-aware representation during serialization.
If ``default_tzinfo`` is explicitly set to ``None`` then no default
tzinfo will be applied to naive datetimes.
You can adjust the error message reported by this class by
changing its ``err_template`` attribute in a subclass on an
instance of this class. By default, the ``err_template``
attribute is the string ``Invalid date``. This string is used as
the interpolation subject of a dictionary composed of ``val`` and
``err``. ``val`` and ``err`` are the unvalidatable value and the
exception caused trying to convert the value, respectively. These
may be used in an overridden err_template as ``${val}`` and
``${err}`` respectively as necessary, e.g. ``_('${val} cannot be
parsed as an iso8601 date: ${err}')``.
For convenience, this type is also willing to coerce
``datetime.date`` objects to a DateTime ISO string representation
during serialization. It does so by using midnight of the day as
the time, and uses the ``default_tzinfo`` to give the
serialization a timezone.
Likewise, for convenience, during deserialization, this type will
convert ``YYYY-MM-DD`` ISO8601 values to a datetime object. It
does so by using midnight of the day as the time, and uses the
``default_tzinfo`` to give the serialization a timezone.
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value will be
returned.
The subnodes of the :class:`colander.SchemaNode` that wraps
this type are ignored.
"""
err_template = _('Invalid date')
def __init__(self, default_tzinfo=iso8601.UTC):
self.default_tzinfo = default_tzinfo
def serialize(self, node, appstruct):
if not appstruct:
return null
if type(appstruct) is datetime.date: # cant use isinstance; dt subs date
appstruct = datetime.datetime.combine(appstruct, datetime.time())
if not isinstance(appstruct, datetime.datetime):
raise Invalid(node,
_('"${val}" is not a datetime object',
mapping={'val':appstruct})
)
if appstruct.tzinfo is None:
appstruct = appstruct.replace(tzinfo=self.default_tzinfo)
return appstruct.isoformat()
def deserialize(self, node, cstruct):
if not cstruct:
return null
try:
result = iso8601.parse_date(
cstruct, default_timezone=self.default_tzinfo)
except iso8601.ParseError as e:
raise Invalid(node, _(self.err_template,
mapping={'val':cstruct, 'err':e}))
return result
class Date(SchemaType):
""" A type representing a Python ``datetime.date`` object.
This type serializes python ``datetime.date`` objects to a
`ISO8601 <http://en.wikipedia.org/wiki/ISO_8601>`_ string format.
The format includes the date only.
The constructor accepts no arguments.
You can adjust the error message reported by this class by
changing its ``err_template`` attribute in a subclass on an
instance of this class. By default, the ``err_template``
attribute is the string ``Invalid date``. This string is used as
the interpolation subject of a dictionary composed of ``val`` and
``err``. ``val`` and ``err`` are the unvalidatable value and the
exception caused trying to convert the value, respectively. These
may be used in an overridden err_template as ``${val}`` and
``${err}`` respectively as necessary, e.g. ``_('${val} cannot be
parsed as an iso8601 date: ${err}')``.
For convenience, this type is also willing to coerce
``datetime.datetime`` objects to a date-only ISO string
representation during serialization. It does so by stripping off
any time information, converting the ``datetime.datetime`` into a
date before serializing.
Likewise, for convenience, this type is also willing to coerce ISO
representations that contain time info into a ``datetime.date``
object during deserialization. It does so by throwing away any
time information related to the serialized value during
deserialization.
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value will be
returned.
The subnodes of the :class:`colander.SchemaNode` that wraps
this type are ignored.
"""
err_template = _('Invalid date')
def serialize(self, node, appstruct):
if not appstruct:
return null
if isinstance(appstruct, datetime.datetime):
appstruct = appstruct.date()
if not isinstance(appstruct, datetime.date):
raise Invalid(node,
_('"${val}" is not a date object',
mapping={'val':appstruct})
)
return appstruct.isoformat()
def deserialize(self, node, cstruct):
if not cstruct:
return null
try:
result = iso8601.parse_date(cstruct)
result = result.date()
except iso8601.ParseError as e:
raise Invalid(node,
_(self.err_template,
mapping={'val':cstruct, 'err':e})
)
return result
class Time(SchemaType):
""" A type representing a Python ``datetime.time`` object.
.. note:: This type is new as of Colander 0.9.3.
This type serializes python ``datetime.time`` objects to a
`ISO8601 <http://en.wikipedia.org/wiki/ISO_8601>`_ string format.
The format includes the time only.
The constructor accepts no arguments.
You can adjust the error message reported by this class by
changing its ``err_template`` attribute in a subclass on an
instance of this class. By default, the ``err_template``
attribute is the string ``Invalid date``. This string is used as
the interpolation subject of a dictionary composed of ``val`` and
``err``. ``val`` and ``err`` are the unvalidatable value and the
exception caused trying to convert the value, respectively. These
may be used in an overridden err_template as ``${val}`` and
``${err}`` respectively as necessary, e.g. ``_('${val} cannot be
parsed as an iso8601 date: ${err}')``.
For convenience, this type is also willing to coerce
``datetime.datetime`` objects to a time-only ISO string
representation during serialization. It does so by stripping off
any date information, converting the ``datetime.datetime`` into a
time before serializing.
Likewise, for convenience, this type is also willing to coerce ISO
representations that contain time info into a ``datetime.time``
object during deserialization. It does so by throwing away any
date information related to the serialized value during
deserialization.
If the :attr:`colander.null` value is passed to the serialize
method of this class, the :attr:`colander.null` value will be
returned.
The subnodes of the :class:`colander.SchemaNode` that wraps
this type are ignored.
"""
err_template = _('Invalid time')
def serialize(self, node, appstruct):
if isinstance(appstruct, datetime.datetime):
appstruct = appstruct.time()
if not isinstance(appstruct, datetime.time):
if not appstruct:
return null
raise Invalid(node,
_('"${val}" is not a time object',
mapping={'val':appstruct})
)
return appstruct.isoformat().split('.')[0]
def deserialize(self, node, cstruct):
if not cstruct:
return null
try:
result = iso8601.parse_date(cstruct)
result = result.time()
except (iso8601.ParseError, TypeError):
try:
result = timeparse(cstruct, '%H:%M:%S')
except ValueError:
try:
result = timeparse(cstruct, '%H:%M')
except Exception as e:
raise Invalid(node,
_(self.err_template,
mapping={'val':cstruct, 'err':e})
)
return result
def timeparse(t, format):
return datetime.datetime(*time.strptime(t, format)[0:6]).time()
def _add_node_children(node, children):
for n in children:
insert_before = getattr(n, 'insert_before', None)
exists = node.get(n.name, _marker) is not _marker
# use exists for microspeed; we could just call __setitem__
# exclusively, but it does an enumeration that's unnecessary in the
# common (nonexisting) case (.add is faster)
if insert_before is None:
if exists:
node[n.name] = n
else:
node.add(n)
else:
if exists:
del node[n.name]
node.add_before(insert_before, n)
class _SchemaNode(object):
"""
Fundamental building block of schemas.
The constructor accepts these positional arguments:
- ``typ``: The 'type' for this node. It should be an
instance of a class that implements the
:class:`colander.interfaces.Type` interface. If ``typ`` is not passed,
a call to the ``schema_type()`` method on this class is made to
get a default type. (When subclassing, ``schema_type()`` should
be overridden to provide a reasonable default type).
- ``*children``: a sequence of subnodes. If the subnodes of this
node are not known at construction time, they can later be added
via the ``add`` method.
The constructor accepts these keyword arguments:
- ``name``: The name of this node.
- ``typ``: The 'type' for this node can optionally be passed in as a
keyword argument. See the documentation for the positional arg above.
- ``default``: The default serialization value for this node when
not set. If ``default`` is :attr:`colander.drop`, the node
will be dropped from schema serialization. If not provided,
the node will be serialized to :attr:`colander.null`.
- ``missing``: The default deserialization value for this node. If it is
not provided, the missing value of this node will be the special marker
value :attr:`colander.required`, indicating that it is considered
'required'. When ``missing`` is :attr:`colander.required`, the
``required`` computed attribute will be ``True``. When ``missing`` is
:attr:`colander.drop`, the node is dropped from the schema if it isn't
set during deserialization.
- ``missing_msg``: Optional error message to be used if the value is
required and missing.
- ``preparer``: Optional preparer for this node. It should be
an object that implements the
:class:`colander.interfaces.Preparer` interface.
- ``validator``: Optional validator for this node. It should be
an object that implements the
:class:`colander.interfaces.Validator` interface.
- ``after_bind``: A callback which is called after a clone of this
node has 'bound' all of its values successfully. This callback
is useful for performing arbitrary actions to the cloned node,
or direct children of the cloned node (such as removing or
adding children) at bind time. A 'binding' is the result of an
execution of the ``bind`` method of the clone's prototype node,
or one of the parents of the clone's prototype nodes. The
deepest nodes in the node tree are bound first, so the
``after_bind`` methods of the deepest nodes are called before
the shallowest. The ``after_bind`` callback should
accept two values: ``node`` and ``kw``. ``node`` will be a
clone of the bound node object, ``kw`` will be the set of
keywords passed to the ``bind`` method.
- ``title``: The title of this node. Defaults to a titleization
of the ``name`` (underscores replaced with empty strings and the
first letter of every resulting word capitalized). The title is
used by higher-level systems (not by Colander itself).
- ``description``: The description for this node. Defaults to
``''`` (the empty string). The description is used by
higher-level systems (not by Colander itself).
- ``widget``: The 'widget' for this node. Defaults to ``None``.
The widget attribute is not interpreted by Colander itself, it
is only meaningful to higher-level systems such as Deform.
- ``insert_before``: if supplied, it names a sibling defined by a
superclass for its parent node; the current node will be inserted
before the named node. It is not useful unless a mapping schema is
inherited from another mapping schema, and you need to control
the ordering of the resulting nodes.
Arbitrary keyword arguments remaining will be attached to the node
object unmolested.
"""
_counter = itertools.count()
preparer = None
validator = None
default = null
missing = required
missing_msg = 'Required'
name = ''
raw_title = _marker # only changes if title is explicitly set
title = _marker
description = ''
widget = None
after_bind = None
bindings = None
def __new__(cls, *args, **kw):
node = object.__new__(cls)
node._order = next(cls._counter)
node.children = []
_add_node_children(node, cls.__all_schema_nodes__)
return node
def __init__(self, *arg, **kw):
# bw compat forces us to treat first arg as type if not a _SchemaNode
if 'typ' in kw:
self.typ = kw.pop('typ')
elif arg and not isinstance(arg[0], _SchemaNode):
self.typ, arg = arg[0], arg[1:]
else:
self.typ = self.schema_type()
_add_node_children(self, arg)
# bw compat forces us to manufacture a title if one is not supplied
title = kw.get('title', self.title)
if title is _marker:
name = kw.get('name', self.name)
kw['title'] = name.replace('_', ' ').title()
else:
kw['raw_title'] = title
self.__dict__.update(kw)
@staticmethod
def schema_type():
raise NotImplementedError(
'Schema node construction without a `typ` argument or '
'a schema_type() callable present on the node class '
)
@property
def required(self):
""" A property which returns ``True`` if the ``missing`` value
related to this node was not specified.
A return value of ``True`` implies that a ``missing`` value wasn't
specified for this node or that the ``missing`` value of this node is
:attr:`colander.required`. A return value of ``False`` implies that
a 'real' ``missing`` value was specified for this node."""
if isinstance(self.missing, deferred): # unbound schema with deferreds
return True
return self.missing is required
def serialize(self, appstruct=null):
""" Serialize the :term:`appstruct` to a :term:`cstruct` based
on the schema represented by this node and return the
cstruct.
If ``appstruct`` is :attr:`colander.null`, return the
serialized value of this node's ``default`` attribute (by
default, the serialization of :attr:`colander.null`).
If an ``appstruct`` argument is not explicitly provided, it
defaults to :attr:`colander.null`.
"""
if appstruct is null:
appstruct = self.default
if isinstance(appstruct, deferred): # unbound schema with deferreds
appstruct = null
cstruct = self.typ.serialize(self, appstruct)
return cstruct
def flatten(self, appstruct):
""" Create and return a data structure which is a flattened
representation of the passed in struct based on the schema represented
by this node. The return data structure is a dictionary; its keys are
dotted names. Each dotted name represents a path to a location in the
schema. The values of of the flattened dictionary are subvalues of
the passed in struct."""
flat = self.typ.flatten(self, appstruct)
return flat
def unflatten(self, fstruct):
""" Create and return a data structure with nested substructures based
on the schema represented by this node using the flattened
representation passed in. This is the inverse operation to
:meth:`colander.SchemaNode.flatten`."""
paths = sorted(fstruct.keys())
return self.typ.unflatten(self, paths, fstruct)
def set_value(self, appstruct, dotted_name, value):
""" Uses the schema to set a value in a nested datastructure from a
dotted name path. """
self.typ.set_value(self, appstruct, dotted_name, value)
def get_value(self, appstruct, dotted_name):
""" Traverses the nested data structure using the schema and retrieves
the value specified by the dotted name path."""
return self.typ.get_value(self, appstruct, dotted_name)
def deserialize(self, cstruct=null):
""" Deserialize the :term:`cstruct` into an :term:`appstruct` based
on the schema, run this :term:`appstruct` through the
preparer, if one is present, then validate the
prepared appstruct. The ``cstruct`` value is deserialized into an
``appstruct`` unconditionally.
If ``appstruct`` returned by type deserialization and
preparation is the value :attr:`colander.null`, do something
special before attempting validation:
- If the ``missing`` attribute of this node has been set explicitly,
return its value. No validation of this value is performed; it is
simply returned.
- If the ``missing`` attribute of this node has not been set
explicitly, raise a :exc:`colander.Invalid` exception error.
If the appstruct is not ``colander.null`` and cannot be validated , a
:exc:`colander.Invalid` exception will be raised.
If a ``cstruct`` argument is not explicitly provided, it
defaults to :attr:`colander.null`.
"""
appstruct = self.typ.deserialize(self, cstruct)
if self.preparer is not None:
# if the preparer is a function, call a single preparer
if hasattr(self.preparer, '__call__'):
appstruct = self.preparer(appstruct)
# if the preparer is a list, call each separate preparer
elif is_nonstr_iter(self.preparer):
for preparer in self.preparer:
appstruct = preparer(appstruct)
if appstruct is null:
appstruct = self.missing
if appstruct is required:
raise Invalid(self, _(self.missing_msg,
mapping={'title': self.title,
'name':self.name}))
if isinstance(appstruct, deferred): # unbound schema with deferreds
raise Invalid(self, self.missing_msg)
# We never deserialize or validate the missing value
return appstruct
if self.validator is not None:
if isinstance(self.validator, deferred): # unbound
raise UnboundDeferredError(
"Schema node {node} has an unbound deferred validator"
.format(node=self))
self.validator(self, appstruct)
return appstruct
def add(self, node):
""" Append a subnode to this node. ``node`` must be a SchemaNode."""
self.children.append(node)
def insert(self, index, node):
""" Insert a subnode into the position ``index``. ``node`` must be
a SchemaNode."""
self.children.insert(index, node)
def add_before(self, name, node):
""" Insert a subnode into the position before the node named ``name``
"""
for pos, sub in enumerate(self.children[:]):
if sub.name == name:
self.insert(pos, node)
return
raise KeyError('No such node named %s' % name)
def get(self, name, default=None):
""" Return the subnode associated with ``name`` or ``default`` if no
such node exists."""
for node in self.children:
if node.name == name:
return node
return default
def clone(self):
""" Clone the schema node and return the clone. All subnodes
are also cloned recursively. Attributes present in node
dictionaries are preserved."""
cloned = self.__class__(self.typ)
cloned.__dict__.update(self.__dict__)
cloned.children = [node.clone() for node in self.children]
return cloned
def bind(self, **kw):
""" Resolve any deferred values attached to this schema node
and its children (recursively), using the keywords passed as
``kw`` as input to each deferred value. This function
*clones* the schema it is called upon and returns the cloned
value. The original schema node (the source of the clone)
is not modified."""
cloned = self.clone()
cloned._bind(kw)
return cloned
def _bind(self, kw):
self.bindings = kw
for child in self.children:
child._bind(kw)
names = dir(self)
for k in names:
v = getattr(self, k)
if isinstance(v, deferred):
v = v(self, kw)
if isinstance(v, SchemaNode):
self[k] = v
else:
setattr(self, k, v)
if getattr(self, 'after_bind', None):
self.after_bind(self, kw)
def cstruct_children(self, cstruct):
""" Will call the node's type's ``cstruct_children`` method with this
node as a first argument, and ``cstruct`` as a second argument."""
cstruct_children = getattr(self.typ, 'cstruct_children', None)
if cstruct_children is None:
warnings.warn(
'The node type %s has no cstruct_children method.'
'This method is required to be implemented by schema types for '
'compatibility with Colander 0.9.9+. In a future Colander '
'version, the absence of this method will cause an '
'exception. Returning [] for compatibility although it '
'may not be the right value.' % self.typ.__class__,
DeprecationWarning,
stacklevel=2
)
return []
return cstruct_children(self, cstruct)
def __delitem__(self, name):
""" Remove a subnode by name """
for idx, node in enumerate(self.children[:]):
if node.name == name:
return self.children.pop(idx)
raise KeyError(name)
def __getitem__(self, name):
""" Get a subnode by name. """
val = self.get(name, _marker)
if val is _marker:
raise KeyError(name)
return val
def __setitem__(self, name, newnode):
""" Replace a subnode by name. ``newnode`` must be a SchemaNode. If
a subnode named ``name`` doesn't already exist, calling this method
is the same as setting the node's name to ``name`` and calling the
``add`` method with the node (it will be appended to the children
list)."""
newnode.name = name
for idx, node in enumerate(self.children[:]):
if node.name == name:
self.children[idx] = newnode
return node
self.add(newnode)
def __iter__(self):
""" Iterate over the children nodes of this schema node """
return iter(self.children)
def __contains__(self, name):
""" Return True if subnode named ``name`` exists in this node """
return self.get(name, _marker) is not _marker
def __repr__(self):
return '<%s.%s object at %d (named %s)>' % (
self.__module__,
self.__class__.__name__,
id(self),
self.name,
)
def raise_invalid(self, msg, node=None):
""" Raise a :exc:`colander.Invalid` exception with the message
``msg``. ``node``, if supplied, should be an instance of a
:class:`colander.SchemaNode`. If it is not supplied, ``node`` will
be this node. Example usage::
class CustomSchemaNode(SchemaNode):
def validator(self, node, cstruct):
if cstruct != 'the_right_thing':
self.raise_invalid('Not the right thing')
"""
if node is None:
node = self
raise Invalid(node, msg)
class _SchemaMeta(type):
def __init__(cls, name, bases, clsattrs):
nodes = []
for name, value in clsattrs.items():
if isinstance(value, _SchemaNode):
delattr(cls, name)
if not value.name:
value.name = name
if value.raw_title is _marker:
value.title = name.replace('_', ' ').title()
nodes.append((value._order, value))
nodes.sort(key=lambda n: n[0])
cls.__class_schema_nodes__ = [ n[1] for n in nodes ]
# Combine all attrs from this class and its _SchemaNode superclasses.
cls.__all_schema_nodes__ = []
for c in reversed(cls.__mro__):
csn = getattr(c, '__class_schema_nodes__', [])
cls.__all_schema_nodes__.extend(csn)
# metaclass spelling compatibility across Python 2 and Python 3
SchemaNode = _SchemaMeta(
'SchemaNode',
(_SchemaNode,),
{'__doc__': _SchemaNode.__doc__}
)
class Schema(SchemaNode):
schema_type = Mapping
MappingSchema = Schema
class TupleSchema(SchemaNode):
schema_type = Tuple
class SequenceSchema(SchemaNode):
schema_type = Sequence
def __init__(self, *args, **kw):
SchemaNode.__init__(self, *args, **kw)
if len(self.children) != 1:
raise Invalid(self,
'Sequence schemas must have exactly one child node')
def clone(self):
""" Clone the schema node and return the clone. All subnodes
are also cloned recursively. Attributes present in node
dictionaries are preserved."""
# Cloning a ``SequenceSchema`` doesn't work with ``_SchemaNode.clone``.
children = [node.clone() for node in self.children]
cloned = self.__class__(self.typ, *children)
attributes = self.__dict__.copy()
attributes.pop('children', None)
cloned.__dict__.update(attributes)
return cloned
class deferred(object):
""" A decorator which can be used to define deferred schema values
(missing values, widgets, validators, etc.)"""
def __init__(self, wrapped):
try:
functools.update_wrapper(self, wrapped)
except AttributeError: #non-function
self.__doc__ = getattr(wrapped, '__doc__', None)
self.wrapped = wrapped
def __call__(self, node, kw):
return self.wrapped(node, kw)
def _unflatten_mapping(node, paths, fstruct,
get_child=None, rewrite_subpath=None):
if get_child is None:
get_child = node.__getitem__
if rewrite_subpath is None:
def rewrite_subpath(subpath):
return subpath
node_name = node.name
if node_name:
prefix = node_name + '.'
else:
prefix = ''
prefix_len = len(prefix)
appstruct = {}
subfstruct = {}
subpaths = []
curname = None
for path in paths:
if path == node_name:
# flattened structs contain non-leaf nodes which are ignored
# during unflattening.
continue
assert path.startswith(prefix), "Bad node: %s" % path
subpath = path[prefix_len:]
if '.' in subpath:
name = subpath[:subpath.index('.')]
else:
name = subpath
if curname is None:
curname = name
elif name != curname:
subnode = get_child(curname)
appstruct[curname] = subnode.typ.unflatten(
subnode, subpaths, subfstruct)
subfstruct = {}
subpaths = []
curname = name
subpath = rewrite_subpath(subpath)
subfstruct[subpath] = fstruct[path]
subpaths.append(subpath)
if curname is not None:
subnode = get_child(curname)
appstruct[curname] = subnode.typ.unflatten(
subnode, subpaths, subfstruct)
return appstruct
class instantiate(object):
"""
A decorator which can be used to instantiate :class:`SchemaNode`
elements inline within a class definition.
All parameters passed to the decorator and passed along to the
:class:`SchemaNode` during instantiation.
"""
def __init__(self,*args,**kw):
self.args,self.kw = args,kw
def __call__(self,class_):
return class_(*self.args,**self.kw)
import sys
PY2 = sys.version_info[0] == 2
PY3 = not PY2
if PY2:
string_types = basestring,
text_type = unicode
else:
string_types = str,
text_type = str
def text_(s, encoding='latin-1', errors='strict'):
""" If ``s`` is an instance of ``bytes``, return ``s.decode(encoding,
errors)``, otherwise return ``s``"""
if isinstance(s, bytes):
return s.decode(encoding, errors)
return s # pragma: no cover
if PY2:
def is_nonstr_iter(v):
return hasattr(v, '__iter__')
else:
def is_nonstr_iter(v):
if isinstance(v, str):
return False
return hasattr(v, '__iter__')
try:
xrange = xrange
except NameError: # pragma: no cover
xrange = range
try:
from cPickle import loads, dumps, HIGHEST_PROTOCOL
except ImportError: # pragma: no cover
from pickle import loads, dumps, HIGHEST_PROTOCOL
def Preparer(value):
"""
A preparer is called after deserialization of a value but before
that value is validated.
Any modifications to ``value`` required should be made by
returning the modified value rather than modifying in-place.
If no modification is required, then ``value`` should be returned
as-is.
"""
def Validator(node, value):
"""
A validator is called after preparation of the deserialized value.
If ``value`` is not valid, raise a :class:`colander.Invalid`
instance as an exception after.
``node`` is a :class:`colander.SchemaNode` instance, for use when
raising a :class:`colander.Invalid` exception.
"""
class Type(object):
def serialize(self, node, appstruct):
"""
Serialize the :term:`appstruct` represented by ``appstruct``
to a :term:`cstruct`. The serialization should be composed of
one or more objects which can be deserialized by the
:meth:`colander.interfaces.Type.deserialize` method of this
type.
``node`` is a :class:`colander.SchemaNode` instance.
``appstruct`` is an :term:`appstruct`.
If ``appstruct`` is the special value :attr:`colander.null`,
the type should serialize a null value.
If the object cannot be serialized for any reason, a
:exc:`colander.Invalid` exception should be raised.
"""
def deserialize(self, node, cstruct):
"""
Deserialze the :term:`cstruct` represented by ``cstruct`` to
an :term:`appstruct`. The deserialization should be composed
of one or more objects which can be serialized by the
:meth:`colander.interfaces.Type.serialize` method of this
type.
``node`` is a :class:`colander.SchemaNode` instance.
``cstruct`` is a :term:`cstruct`.
If the object cannot be deserialized for any reason, a
:exc:`colander.Invalid` exception should be raised.
"""
from __future__ import absolute_import
import iso8601
from iso8601.iso8601 import (parse_date, ParseError, Utc, FixedOffset, UTC, ZERO, ISO8601_REGEX)
__all__ = ["parse_date", "ParseError", "Utc", "FixedOffset"]
# Translations template for colander.
# Copyright (C) 2016 ORGANIZATION
# This file is distributed under the same license as the colander project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2016.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: colander 1.3.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-09-18 22:57+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
#: colander/__init__.py:294
msgid "Invalid value"
msgstr ""
#: colander/__init__.py:340
msgid "String does not match expected pattern"
msgstr ""
#: colander/__init__.py:359
msgid "Invalid email address"
msgstr ""
#: colander/__init__.py:387
msgid "${val} is less than minimum value ${min}"
msgstr ""
#: colander/__init__.py:388
msgid "${val} is greater than maximum value ${max}"
msgstr ""
#: colander/__init__.py:435
msgid "Shorter than minimum length ${min}"
msgstr ""
#: colander/__init__.py:436
msgid "Longer than maximum length ${max}"
msgstr ""
#: colander/__init__.py:464
msgid "\"${val}\" is not one of ${choices}"
msgstr ""
#: colander/__init__.py:479
msgid "\"${val}\" must not be one of ${choices}"
msgstr ""
#: colander/__init__.py:501
msgid "One or more of the choices you made was not acceptable"
msgstr ""
#: colander/__init__.py:523 colander/__init__.py:528
msgid "\"${val}\" is not a valid credit card number"
msgstr ""
#: colander/__init__.py:549
msgid "Must be a URL"
msgstr ""
#: colander/__init__.py:553
msgid "Invalid UUID string"
msgstr ""
#: colander/__init__.py:650
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr ""
#: colander/__init__.py:694
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr ""
#: colander/__init__.py:789 colander/__init__.py:1020
msgid "\"${val}\" is not iterable"
msgstr ""
#: colander/__init__.py:797
msgid "\"${val}\" has an incorrect number of elements (expected ${exp}, was ${was})"
msgstr ""
#: colander/__init__.py:936 colander/__init__.py:967
msgid "${cstruct} is not iterable"
msgstr ""
#: colander/__init__.py:1254
msgid "${val} cannot be serialized: ${err}"
msgstr ""
#: colander/__init__.py:1275
msgid "${val} is not a string: ${err}"
msgstr ""
#: colander/__init__.py:1295 colander/__init__.py:1306
msgid "\"${val}\" is not a number"
msgstr ""
#: colander/__init__.py:1454
msgid "${val} is not a string"
msgstr ""
#: colander/__init__.py:1465
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr ""
#: colander/__init__.py:1525 colander/__init__.py:1542 colander/__init__.py:1552
msgid "relative name \"${val}\" irresolveable without package"
msgstr ""
#: colander/__init__.py:1582
msgid "\"${val}\" has no __name__"
msgstr ""
#: colander/__init__.py:1591
msgid "\"${val}\" is not a string"
msgstr ""
#: colander/__init__.py:1600
msgid "The dotted name \"${name}\" cannot be imported"
msgstr ""
#: colander/__init__.py:1648 colander/__init__.py:1722
msgid "Invalid date"
msgstr ""
#: colander/__init__.py:1662
msgid "\"${val}\" is not a datetime object"
msgstr ""
#: colander/__init__.py:1733
msgid "\"${val}\" is not a date object"
msgstr ""
#: colander/__init__.py:1794
msgid "Invalid time"
msgstr ""
#: colander/__init__.py:1804
msgid "\"${val}\" is not a time object"
msgstr ""
#: colander/tests/test_colander.py:334 colander/tests/test_colander.py:341
msgid "fail ${val}"
msgstr ""
#: colander/tests/test_colander.py:537
msgid "${val}: ${choices}"
msgstr ""
# Czech translations for colander.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the colander project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.8\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-05-19 13:15+0200\n"
"PO-Revision-Date: 2011-10-15 17:25+0300\n"
"Last-Translator: Petr Viktorin <encukou@gmail.com>\n"
"Language-Team: Petr Viktorin <encukou@gmail.com>\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: colander/__init__.py:233
msgid "Invalid value"
msgstr "Neplatná hodnota"
#: colander/__init__.py:270
msgid "String does not match expected pattern"
msgstr "Text neodpovídá očekávané struktuře"
#: colander/__init__.py:287
msgid "Invalid email address"
msgstr "Neplatná e-mailová adresa"
#: colander/__init__.py:315
msgid "${val} is less than minimum value ${min}"
msgstr "${val} je menší než minimální hodnota, ${min}"
#: colander/__init__.py:316
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} je větší než maximální hodnota, ${max}"
#: colander/__init__.py:348
msgid "Shorter than minimum length ${min}"
msgstr "Kratší než minimální délka, ${min}"
#: colander/__init__.py:354
msgid "Longer than maximum length ${max}"
msgstr "Delší než maximální délka, ${max}"
#: colander/__init__.py:367
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" není z ${choices}"
#: colander/__init__.py:377
msgid "One or more of the choices you made was not acceptable"
msgstr ""
#: colander/__init__.py:423
msgid "Must be a URL"
msgstr ""
#: colander/__init__.py:519
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" není typu zobrazení: ${err}"
#: colander/__init__.py:560
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Neznámé klíče v zobrazení: \"${val}\""
#: colander/__init__.py:656 colander/__init__.py:856
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" není sekvence"
#: colander/__init__.py:664
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was "
"${was})"
msgstr "\"${val}\" má špatný počet položek (${was} místo ${exp})"
#: colander/__init__.py:803
msgid "${cstruct} is not iterable"
msgstr "${cstruct} není sekvence"
#: colander/__init__.py:1075
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} nemůže být serializováno: ${err}"
#: colander/__init__.py:1093
msgid "${val} is not a string: ${err}"
msgstr "${val} není řetězec: ${err}"
#: colander/__init__.py:1113 colander/__init__.py:1124
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" není číslo"
#: colander/__init__.py:1268
msgid "${val} is not a string"
msgstr "${val} není řetězec"
#: colander/__init__.py:1279
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr ""
#: colander/__init__.py:1339 colander/__init__.py:1356
#: colander/__init__.py:1366
msgid "relative name \"${val}\" irresolveable without package"
msgstr "relativní jméno \"${val}\" je neplatné bez Pythonového balíčku"
#: colander/__init__.py:1396
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" nemá __name__"
#: colander/__init__.py:1405
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" není řetězec"
#: colander/__init__.py:1414
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "Jméno \"${name}\" nemohlo být importováno"
#: colander/__init__.py:1462 colander/__init__.py:1538
msgid "Invalid date"
msgstr "Neplatné datum"
#: colander/__init__.py:1478
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" není objekt s časem a datem"
#: colander/__init__.py:1549
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" není objekt s datem"
#: colander/__init__.py:1610
#, fuzzy
#| msgid "Invalid date"
msgid "Invalid time"
msgstr "Neplatné datum"
#: colander/__init__.py:1621
#, fuzzy
#| msgid "\"${val}\" is not a datetime object"
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" není objekt s časem a datem"
#: colander/__init__.py:1878 colander/__init__.py:1880
msgid "Required"
msgstr "Povinné pole"
# German (Germany) translations for colander.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the colander project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.5.2\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-09-18 22:57+0200\n"
"PO-Revision-Date: 2016-09-18 23:02+0200\n"
"Last-Translator: Andreas Kaiser <kaiser@xo7.de>\n"
"Language: de\n"
"Language-Team: repoze developers <repoze-dev@lists.repoze.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
"X-Generator: Poedit 1.8.9\n"
#: colander/__init__.py:294
msgid "Invalid value"
msgstr "Ungültiger Wert"
#: colander/__init__.py:340
msgid "String does not match expected pattern"
msgstr "Die Zeichenkette entspricht nicht dem erwarteten Muster"
#: colander/__init__.py:359
msgid "Invalid email address"
msgstr "Ungültige E-Mail-Adresse"
#: colander/__init__.py:387
msgid "${val} is less than minimum value ${min}"
msgstr "${val} ist kleiner als der erlaubte Mindestwert (${min})"
#: colander/__init__.py:388
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} ist größer als der erlaubte Höchstwert (${max})"
#: colander/__init__.py:435
msgid "Shorter than minimum length ${min}"
msgstr "Kürzer als erlaubt, die Mindestlänge beträgt ${min}"
#: colander/__init__.py:436
msgid "Longer than maximum length ${max}"
msgstr "Länger als erlaubt, die Maximallänge beträgt ${max}"
#: colander/__init__.py:464
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" ist nicht in der Auswahl ${choices}"
#: colander/__init__.py:479
msgid "\"${val}\" must not be one of ${choices}"
msgstr "\"${val}\" darf nichts von ${choices} sein"
#: colander/__init__.py:501
msgid "One or more of the choices you made was not acceptable"
msgstr "Mindestens eine Auswahl war nicht akzeptabel"
#: colander/__init__.py:523 colander/__init__.py:528
msgid "\"${val}\" is not a valid credit card number"
msgstr "\"${val}\" ist keine gültige Kreditkartennummer"
#: colander/__init__.py:549
msgid "Must be a URL"
msgstr "Muss eine URL sein"
#: colander/__init__.py:553
msgid "Invalid UUID string"
msgstr "Ungültige UUID Zeichenkette"
#: colander/__init__.py:650
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" ist kein Mapping: ${err}"
#: colander/__init__.py:694
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Unbekannte Schlüssel im Mapping: ${val}"
#: colander/__init__.py:789 colander/__init__.py:1020
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" ist nicht iterierbar"
#: colander/__init__.py:797
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was "
"${was})"
msgstr "Ungültige Anzahl von Elementen (${was}, erwartet: ${exp})"
#: colander/__init__.py:936 colander/__init__.py:967
msgid "${cstruct} is not iterable"
msgstr "${cstruct} ist nicht iterierbar"
#: colander/__init__.py:1254
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} kann nicht serialisiert werden: ${err}"
#: colander/__init__.py:1275
msgid "${val} is not a string: ${err}"
msgstr "${val} ist keine Zeichenkette: ${err}"
#: colander/__init__.py:1295 colander/__init__.py:1306
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" ist keine Zahl"
#: colander/__init__.py:1454
msgid "${val} is not a string"
msgstr "${val} ist keine Zeichenkette"
#: colander/__init__.py:1465
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr ""
"\"${val}\" ist weder in (${false_choices}) noch in (${true_choices}) "
"enthalten"
#: colander/__init__.py:1525 colander/__init__.py:1542
#: colander/__init__.py:1552
msgid "relative name \"${val}\" irresolveable without package"
msgstr "relativer Name \"${val}\" ist ohne Paket nicht auflösbar"
#: colander/__init__.py:1582
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" hat kein __name__ Attribut"
#: colander/__init__.py:1591
msgid "\"${val}\" is not a string"
msgstr "${val} ist keine Zeichenkette"
#: colander/__init__.py:1600
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "Der Dotted-Name \"${name}\" kann nicht importiert werden"
#: colander/__init__.py:1648 colander/__init__.py:1722
msgid "Invalid date"
msgstr "Ungültiges Datum"
#: colander/__init__.py:1662
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" ist kein Datetime-Object"
#: colander/__init__.py:1733
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" ist kein Date-Object"
#: colander/__init__.py:1794
msgid "Invalid time"
msgstr "Ungültige Uhrzeit"
#: colander/__init__.py:1804
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" ist kein Time-Objekt"
#: colander/tests/test_colander.py:334 colander/tests/test_colander.py:341
msgid "fail ${val}"
msgstr "fehlgeschlagen"
#: colander/tests/test_colander.py:537
msgid "${val}: ${choices}"
msgstr "\"${val}”: ${choices}"
#~ msgid "\"${val}\" is required but missing"
#~ msgstr "\"${val}\" ist eine Pflichtangabe"
#~ msgid "${val} cannot be parsed as an iso8601 date: ${err}"
#~ msgstr "${val} ist keine gültige Zeitangabe nach ISO8601: ${err}"
#~ msgid "Required"
#~ msgstr "Pflichtangabe"
# Greek translations for colander.
# Copyright (C) 2013 ORGANIZATION
# This file is distributed under the same license as the colander project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 1.0b1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-11-16 14:23+0900\n"
"PO-Revision-Date: 2015-03-04 10:03+0200\n"
"Last-Translator: Daniel Dourvaris <dan@car.gr>\n"
"Language-Team: el <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: colander/__init__.py:240
msgid "Invalid value"
msgstr "Λάθος στοιχείο"
#: colander/__init__.py:283
msgid "String does not match expected pattern"
msgstr "Το κείμενο δέν αντιστοιχεί στην μακέτα"
#: colander/__init__.py:302
msgid "Invalid email address"
msgstr "Λάθος διεύθηνση email"
#: colander/__init__.py:330
msgid "${val} is less than minimum value ${min}"
msgstr "${val} είναι λιγότερο απο το ελάχιστο ${min}"
#: colander/__init__.py:331
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} είναι μεγαλύτερο απο το μέγιστο ${max}"
#: colander/__init__.py:363
msgid "Shorter than minimum length ${min}"
msgstr "Λιγότερο απο το ελάχιστο ${min} στοιχεία"
#: colander/__init__.py:369
msgid "Longer than maximum length ${max}"
msgstr "Μεγαλύτερο απο το μέγιστο ${max} χαρακτήρες"
#: colander/__init__.py:382
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" δέν είναι ενα απο ${choices}"
#: colander/__init__.py:392
msgid "One or more of the choices you made was not acceptable"
msgstr "Ενα η παραπάνω απο τις επιλογές δέν ήταν αποδεχτό"
#: colander/__init__.py:414 colander/__init__.py:419
msgid "\"${val}\" is not a valid credit card number"
msgstr "\"${val}'" δέν είναι έγκυρη πιστοτική κάρτα"
#: colander/__init__.py:440
msgid "Must be a URL"
msgstr "Πρέπει να είναι URL"
#: colander/__init__.py:536
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" δέν είναι τύπου mapping: ${err}"
#: colander/__init__.py:578
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Αγνωστα keys στο mapping: \"${val}\""
#: colander/__init__.py:674 colander/__init__.py:905
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" δέν είναι λίστα"
#: colander/__init__.py:682
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was "
"${was})"
msgstr ""
"\"${val}\" έχει λάθος νούμερο στοιχέιων (ήθελε ${exp}, έχει "
"${was})"
#: colander/__init__.py:821 colander/__init__.py:852
msgid "${cstruct} is not iterable"
msgstr "${cstruct} δέν είναι λίστα"
#: colander/__init__.py:1124
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} δέν μπορεί να γίνει serialize:${err}"
#: colander/__init__.py:1142
msgid "${val} is not a string: ${err}"
msgstr "${val} δέν είναι κείμενο: ${err}"
#: colander/__init__.py:1162 colander/__init__.py:1173
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" δέν είναι νούμερο"
#: colander/__init__.py:1317
msgid "${val} is not a string"
msgstr "${val} δέν είναι κείμενο"
#: colander/__init__.py:1328
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr "\"${val}\" ούτε στο (${false_choices}) είναι, ούτε στο (${true_choices})"
#: colander/__init__.py:1388 colander/__init__.py:1405
#: colander/__init__.py:1415
msgid "relative name \"${val}\" irresolveable without package"
msgstr ""
#: colander/__init__.py:1445
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" δέν έχει __name__"
#: colander/__init__.py:1454
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" δέν είναι κείμενο"
#: colander/__init__.py:1463
msgid "The dotted name \"${name}\" cannot be imported"
msgstr ""
#: colander/__init__.py:1511 colander/__init__.py:1587
msgid "Invalid date"
msgstr "Λάθος ημερομηνία"
#: colander/__init__.py:1527
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" δέν είναι τύπου datetime"
#: colander/__init__.py:1598
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" δέν είναι τύπου date"
#: colander/__init__.py:1659
msgid "Invalid time"
msgstr "Λάθος ώρα"
#: colander/__init__.py:1670
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" δέν είναι τύπου time"
#: colander/__init__.py:1795
msgid "Required"
msgstr "Απαραίτητο"
#: colander/tests/test_colander.py:295 colander/tests/test_colander.py:302
msgid "fail ${val}"
msgstr "λάθος ${val}"
#: colander/tests/test_colander.py:469
msgid "${val}: ${choices}"
msgstr "${val}: ${choices}"
# Spanish translations for colander.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the colander project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.5.2\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-05-19 13:15+0200\n"
"PO-Revision-Date: 2010-09-10 08:03-0600\n"
"Last-Translator: Douglas Cerna <douglascerna@yahoo.com>\n"
"Language-Team: repoze developers <repoze-dev@lists.repoze.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: colander/__init__.py:233
msgid "Invalid value"
msgstr "Valor inválido"
#: colander/__init__.py:270
msgid "String does not match expected pattern"
msgstr "La cadena no coincide con el patrón esperado"
#: colander/__init__.py:287
msgid "Invalid email address"
msgstr "Dirección de correo electrónico inválida"
#: colander/__init__.py:315
msgid "${val} is less than minimum value ${min}"
msgstr "${val} es menor que el valor mínimo ${min}"
#: colander/__init__.py:316
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} es mayor que el valor máximo ${max}"
#: colander/__init__.py:348
msgid "Shorter than minimum length ${min}"
msgstr "Más corto que la longitud mínima ${min}"
#: colander/__init__.py:354
msgid "Longer than maximum length ${max}"
msgstr "Más largo que la longitud máxima ${max}"
#: colander/__init__.py:367
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" no está en ${choices}"
#: colander/__init__.py:377
msgid "One or more of the choices you made was not acceptable"
msgstr ""
#: colander/__init__.py:423
msgid "Must be a URL"
msgstr ""
#: colander/__init__.py:519
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" no es un tipo de mapeo: ${err}"
#: colander/__init__.py:560
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Claves no reconocidas en el mapeo: \"${val}\""
#: colander/__init__.py:656 colander/__init__.py:856
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" no es iterable"
#: colander/__init__.py:664
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was "
"${was})"
msgstr ""
"\"${val}\" tiene un número incorrecto de elementos (esperados ${exp}, "
"obtenidos ${was})"
#: colander/__init__.py:803
msgid "${cstruct} is not iterable"
msgstr "${cstruct} no es iterable"
#: colander/__init__.py:1075
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} no puede serializarse: ${err}"
#: colander/__init__.py:1093
msgid "${val} is not a string: ${err}"
msgstr "${val} no es una cadena: ${err}"
#: colander/__init__.py:1113 colander/__init__.py:1124
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" no es un número"
#: colander/__init__.py:1268
msgid "${val} is not a string"
msgstr "${val} no es una cadena"
#: colander/__init__.py:1279
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr ""
#: colander/__init__.py:1339 colander/__init__.py:1356
#: colander/__init__.py:1366
msgid "relative name \"${val}\" irresolveable without package"
msgstr "nombre relativo \"${val}\" no se puede resolver sin paquete"
#: colander/__init__.py:1396
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" no tiene __name__"
#: colander/__init__.py:1405
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" no es una cadena"
#: colander/__init__.py:1414
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "El nombre con puntos \"${name}\" no pudo importarse"
#: colander/__init__.py:1462 colander/__init__.py:1538
msgid "Invalid date"
msgstr "Fecha inválida"
#: colander/__init__.py:1478
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" no es un objeto datetime"
#: colander/__init__.py:1549
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" no es un objeto date"
#: colander/__init__.py:1610
#, fuzzy
#| msgid "Invalid date"
msgid "Invalid time"
msgstr "Fecha inválida"
#: colander/__init__.py:1621
#, fuzzy
#| msgid "\"${val}\" is not a datetime object"
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" no es un objeto datetime"
#: colander/__init__.py:1878 colander/__init__.py:1880
msgid "Required"
msgstr "Requerido"
#~ msgid "\"${val}\" is required but missing"
#~ msgstr "\"${val}\" es requerido pero falta"
#~ msgid "${val} cannot be parsed as an iso8601 date: ${err}"
#~ msgstr "${val} no puede parsearse como una fecha iso8601: ${err}"
# Translations template for colander.
# Copyright (C) 2013 ORGANIZATION
# This file is distributed under the same license as the colander project.
# Antti Haapala <antti.haapala@anttipatterns.fi>, 2013.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 1.0b1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-11-16 14:23+0900\n"
"PO-Revision-Date: 2015-10-04 09:39+0200\n"
"Last-Translator: Antti Haapala <antti.haapala@anttipatterns.fi>\n"
"Language-Team: Finnish\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.7.5\n"
#: colander/__init__.py:240
msgid "Invalid value"
msgstr "Epäkelpo arvo"
#: colander/__init__.py:283
msgid "String does not match expected pattern"
msgstr "Merkkijono ei ole odotetun muotoinen"
#: colander/__init__.py:302
msgid "Invalid email address"
msgstr "Epäkelpo sähköpostiosoite"
#: colander/__init__.py:330
msgid "${val} is less than minimum value ${min}"
msgstr "${val} on vähemmän kuin pienin arvo ${min}"
#: colander/__init__.py:331
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} on suurempi kuin suurin arvo ${max}"
#: colander/__init__.py:363
msgid "Shorter than minimum length ${min}"
msgstr "Lyhyempi kuin pienin pituus ${min}"
#: colander/__init__.py:369
msgid "Longer than maximum length ${max}"
msgstr "Pidempi kuin suurin pituus ${max}"
#: colander/__init__.py:382
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" ei joukosta ${choices}"
#: colander/__init__.py:392
msgid "One or more of the choices you made was not acceptable"
msgstr "Yksi tai useampi tekemistäsi valinnoista eivät olleet hyväksyttäviä"
#: colander/__init__.py:414 colander/__init__.py:419
msgid "\"${val}\" is not a valid credit card number"
msgstr "\"${val}\" ei ole kelpo luottokortinnumero"
#: colander/__init__.py:440
msgid "Must be a URL"
msgstr "Pitää olla URL-osoite"
#: colander/__init__.py:536
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" ei ole assosiatiivistä tyyppiä (ts. mapping type): ${err}"
#: colander/__init__.py:578
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Tunnistamattomia avaimia arvossa: \"${val}\""
#: colander/__init__.py:674 colander/__init__.py:905
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" ei ole iteroitava"
#: colander/__init__.py:682
msgid "\"${val}\" has an incorrect number of elements (expected ${exp}, was ${was})"
msgstr "Arvossa \"${val}\" on väärä määrä alkioita (odotettu ${exp}, oli ${was})"
#: colander/__init__.py:821 colander/__init__.py:852
msgid "${cstruct} is not iterable"
msgstr "${cstruct} ei ole iteroitava"
#: colander/__init__.py:1124
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} ei serialisoitunut: ${err}"
#: colander/__init__.py:1142
msgid "${val} is not a string: ${err}"
msgstr "${val} ei ole merkkijono: ${err}"
#: colander/__init__.py:1162 colander/__init__.py:1173
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" ei ole luku"
#: colander/__init__.py:1317
msgid "${val} is not a string"
msgstr "${val} ei ole merkkijono"
#: colander/__init__.py:1328
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr "\"${val}\" yksikään joukosta (${false_choices}) tai joukosta (${true_choices})"
#: colander/__init__.py:1388 colander/__init__.py:1405
#: colander/__init__.py:1415
msgid "relative name \"${val}\" irresolveable without package"
msgstr "Suhteellista nimeä \"${val}\" ei voi selvittää ilman pakettia"
#: colander/__init__.py:1445
msgid "\"${val}\" has no __name__"
msgstr "Arvolla \"${val}\" ei ole attribuuttia __name__"
#: colander/__init__.py:1454
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" ei ole merkkijono"
#: colander/__init__.py:1463
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "Pisteellistä nimeä \"${name}\" ei voi tuoda"
#: colander/__init__.py:1511 colander/__init__.py:1587
msgid "Invalid date"
msgstr "Epäkelpo päivämäärä"
#: colander/__init__.py:1527
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" ei ole datetime-luokan olio"
#: colander/__init__.py:1598
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" ei ole date-luokan olio"
#: colander/__init__.py:1659
msgid "Invalid time"
msgstr "Epäkelpo aika"
#: colander/__init__.py:1670
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" ei ole time-luokan olio"
#: colander/__init__.py:1795
msgid "Required"
msgstr "Vaadittu"
#: colander/tests/test_colander.py:295 colander/tests/test_colander.py:302
msgid "fail ${val}"
msgstr "virhe ${val}"
#: colander/tests/test_colander.py:469
msgid "${val}: ${choices}"
msgstr "${val}: ${choices}"
# French translations for colander.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the colander project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.8\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-05-19 13:15+0200\n"
"PO-Revision-Date: 2014-06-27 11:46+0100\n"
"Last-Translator: Cédric Messiant <cedric.messiant@gmail.com>\n"
"Language-Team: fr <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
"X-Generator: Poedit 1.5.4\n"
#: colander/__init__.py:233
msgid "Invalid value"
msgstr "Valeur incorrecte"
#: colander/__init__.py:270
msgid "String does not match expected pattern"
msgstr "La chaîne de caractères ne correspond pas au modèle attendu"
#: colander/__init__.py:287
msgid "Invalid email address"
msgstr "Adresse email invalide"
#: colander/__init__.py:315
msgid "${val} is less than minimum value ${min}"
msgstr "${val} est plus petit que la valeur minimale autorisée (${min})"
#: colander/__init__.py:316
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} est plus grand que la valeur maximum autorisée (${max})"
#: colander/__init__.py:348
msgid "Shorter than minimum length ${min}"
msgstr "La longueur est inférieure à la taille minimum autorisée (${min})"
#: colander/__init__.py:354
msgid "Longer than maximum length ${max}"
msgstr "La longueur dépasse la taille maximum autorisée (${max})"
#: colander/__init__.py:367
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" ne fait pas partie des choix suivants ${choices}"
#: colander/__init__.py:377
msgid "One or more of the choices you made was not acceptable"
msgstr "Un ou plusieurs choix invalides"
#: colander/__init__.py:423
msgid "Must be a URL"
msgstr "Doit être une URL valide"
#: colander/__init__.py:519
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr ""
"\"${val}\" n'est pas du type table de correspondance (dictionnaire par "
"exemple): ${err}"
#: colander/__init__.py:560
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Clé inconnue dans dans la table de correspondance: \"${val}\""
#: colander/__init__.py:656 colander/__init__.py:856
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" n'est pas itérable"
#: colander/__init__.py:664
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was ${was})"
msgstr ""
"\"${val}\" possède un nombre incorrect d'éléments (attendu ${exp}, trouvé "
"${was})"
#: colander/__init__.py:803
msgid "${cstruct} is not iterable"
msgstr "${cstruct} n'est pas itérable"
#: colander/__init__.py:1075
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} ne peut être sérialisé: ${err}"
#: colander/__init__.py:1093
msgid "${val} is not a string: ${err}"
msgstr "${val} n'est pas une chaîne de caractères: ${err}"
#: colander/__init__.py:1113 colander/__init__.py:1124
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" n'est pas un nombre"
#: colander/__init__.py:1268
msgid "${val} is not a string"
msgstr "${val} n'est pas une chaîne de caractères"
#: colander/__init__.py:1279
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr ""
"\"${val}\" ne fait partie ni de (${false_choices}) ni de (${true_choices})"
#: colander/__init__.py:1339 colander/__init__.py:1356
#: colander/__init__.py:1366
msgid "relative name \"${val}\" irresolveable without package"
msgstr "le nom relatif \"${val}\" ne peut-être résolu sans son module intégré"
#: colander/__init__.py:1396
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" ne possède pas l'attribut __name__"
#: colander/__init__.py:1405
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" n'est pas une chaîne de caractères"
#: colander/__init__.py:1414
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "Le symbole python \"${name}\" n'a pu être importé"
#: colander/__init__.py:1462 colander/__init__.py:1538
msgid "Invalid date"
msgstr "Date invalide"
#: colander/__init__.py:1478
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" n'est pas un objet datetime"
#: colander/__init__.py:1549
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" n'est pas un objet date"
#: colander/__init__.py:1610
#| msgid "Invalid date"
msgid "Invalid time"
msgstr "Heure invalide"
#: colander/__init__.py:1621
#| msgid "\"${val}\" is not a datetime object"
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" n'est pas un objet time"
#: colander/__init__.py:1878 colander/__init__.py:1880
msgid "Required"
msgstr "Requis"
# Italian translations for colander.
# Copyright (C) 2013 ORGANIZATION
# This file is distributed under the same license as the colander project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 1.0a3\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-05-19 13:15+0200\n"
"PO-Revision-Date: 2013-05-19 14:57+0100\n"
"Last-Translator: Lorenzo M. Catucci <lorenzo@sancho.ccd.uniroma2.it>\n"
"Language-Team: it <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: colander/__init__.py:233
msgid "Invalid value"
msgstr "Valore non valido"
#: colander/__init__.py:270
msgid "String does not match expected pattern"
msgstr "La stringa non corrisponde al modello atteso"
#: colander/__init__.py:287
msgid "Invalid email address"
msgstr "Indirizzo di posta elettronica non valido"
#: colander/__init__.py:315
msgid "${val} is less than minimum value ${min}"
msgstr "${val} è minore del valore minimo ${min}"
#: colander/__init__.py:316
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} è maggiore del valore massimo ${max}"
#: colander/__init__.py:348
msgid "Shorter than minimum length ${min}"
msgstr "Lunghezza inferiore alla minima ammessa (${min})"
#: colander/__init__.py:354
msgid "Longer than maximum length ${max}"
msgstr "Lunghezza superiore alla massima ammessa (${max})"
#: colander/__init__.py:367
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" non è compreso in ${choices}"
#: colander/__init__.py:377
msgid "One or more of the choices you made was not acceptable"
msgstr "Almeno una delle scelte non è accettabile"
#: colander/__init__.py:423
msgid "Must be a URL"
msgstr "Deve essere un URL"
#: colander/__init__.py:519
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" non è un tipo di mapping: ${err}"
#: colander/__init__.py:560
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Chiavi non riconosciute nella mappa \"${val}\""
#: colander/__init__.py:656 colander/__init__.py:856
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" non è iterabile"
#: colander/__init__.py:664
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was "
"${was})"
msgstr "\"${val}\" contiene ${was} elementi anziché gli attesi ${exp}"
#: colander/__init__.py:803
msgid "${cstruct} is not iterable"
msgstr "${cstruct} non è iterabile"
#: colander/__init__.py:1075
msgid "${val} cannot be serialized: ${err}"
msgstr "impossibile rappresentare ${val}: ${err}"
#: colander/__init__.py:1093
msgid "${val} is not a string: ${err}"
msgstr "${val} non è una stringa: ${err}"
#: colander/__init__.py:1113 colander/__init__.py:1124
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" non è un numero"
#: colander/__init__.py:1268
msgid "${val} is not a string"
msgstr "${val} non è una stringa"
#: colander/__init__.py:1279
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr "\"${val}\" non è contenuto né in ${false_choices} né in ${true_choices}"
#: colander/__init__.py:1339 colander/__init__.py:1356
#: colander/__init__.py:1366
msgid "relative name \"${val}\" irresolveable without package"
msgstr "impossibile risolvere il nome relativo \"${val}\" in assenza di un package"
#: colander/__init__.py:1396
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" non ha un __name__"
#: colander/__init__.py:1405
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" non è una stringa"
#: colander/__init__.py:1414
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "Impossibile importare l'oggetto corrispondente al nome \"${name}\""
#: colander/__init__.py:1462 colander/__init__.py:1538
msgid "Invalid date"
msgstr "Data non valida"
#: colander/__init__.py:1478
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" non è un oggetto «datetime»"
#: colander/__init__.py:1549
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" non è un oggetto «date»"
#: colander/__init__.py:1610
msgid "Invalid time"
msgstr "Orario non valido"
#: colander/__init__.py:1621
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" non è un oggetto «time»"
#: colander/__init__.py:1878 colander/__init__.py:1880
msgid "Required"
msgstr "Richiesto"
# Japanese translations for colander.
# Copyright (C) 2012 ORGANIZATION
# This file is distributed under the same license as the colander project.
# OCHIAI, Gouji <gjo.ext@gmail.com>, 2012-2013.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.8\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-11-16 14:23+0900\n"
"PO-Revision-Date: 2013-11-16 14:30+0900\n"
"Last-Translator: OCHIAI, Gouji <gjo.ext@gmail.com>\n"
"Language-Team: ja <LL@li.org>\n"
"Plural-Forms: nplurals=1; plural=0\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: colander/__init__.py:240
msgid "Invalid value"
msgstr "無効な値です"
#: colander/__init__.py:283
msgid "String does not match expected pattern"
msgstr "文字列がパターンに一致しません"
#: colander/__init__.py:302
msgid "Invalid email address"
msgstr "無効なメールアドレスです"
#: colander/__init__.py:330
msgid "${val} is less than minimum value ${min}"
msgstr "${val} は最小値 ${min} を下回っています"
#: colander/__init__.py:331
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} は最大値 ${max} を超過しています"
#: colander/__init__.py:363
msgid "Shorter than minimum length ${min}"
msgstr "${min} 以上の長さが必要です"
#: colander/__init__.py:369
msgid "Longer than maximum length ${max}"
msgstr "${max} より短くしてください"
#: colander/__init__.py:382
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" は ${choices} のいずれかでなければなりません"
#: colander/__init__.py:392
msgid "One or more of the choices you made was not acceptable"
msgstr "選択された値のいくつかが許容される値ではありません"
#: colander/__init__.py:414 colander/__init__.py:419
msgid "\"${val}\" is not a valid credit card number"
msgstr "\"${val}\" は妥当なクレジットカード番号ではありません"
#: colander/__init__.py:440
msgid "Must be a URL"
msgstr "URLでなければなりません"
#: colander/__init__.py:536
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" はマップ型でなければなりません: ${err}"
#: colander/__init__.py:578
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "未定義のキーがマップに含まれています: \"${val}\""
#: colander/__init__.py:674 colander/__init__.py:905
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" は iterable でなければなりません"
#: colander/__init__.py:682
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was "
"${was})"
msgstr "\"${val}\" の要素数が正しくありません (${exp} 個のはずが ${was} 個)"
#: colander/__init__.py:821 colander/__init__.py:852
msgid "${cstruct} is not iterable"
msgstr "${cstruct} は iterable でなければなりません"
#: colander/__init__.py:1124
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} が直列化できません: ${err}"
#: colander/__init__.py:1142
msgid "${val} is not a string: ${err}"
msgstr "${val} は文字列ではありません: ${err}"
#: colander/__init__.py:1162 colander/__init__.py:1173
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" は数値ではありません"
#: colander/__init__.py:1317
msgid "${val} is not a string"
msgstr "${val} は文字列ではありません"
#: colander/__init__.py:1328
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr "\"${val}\" が (${false_choices}) にも (${true_choices}) にも該当しません"
#: colander/__init__.py:1388 colander/__init__.py:1405
#: colander/__init__.py:1415
msgid "relative name \"${val}\" irresolveable without package"
msgstr "相対名 \"${val}\" はパッケージを指定しなければ名前解決できません"
#: colander/__init__.py:1445
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" には __name__ が含まれていません"
#: colander/__init__.py:1454
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" は文字列ではありません"
#: colander/__init__.py:1463
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "ドット区切り名 \"${name}\" がインポートできませんでした"
#: colander/__init__.py:1511 colander/__init__.py:1587
msgid "Invalid date"
msgstr "無効な日付です"
#: colander/__init__.py:1527
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" は datetime オブジェクトではありません"
#: colander/__init__.py:1598
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" は date オブジェクトではありません"
#: colander/__init__.py:1659
msgid "Invalid time"
msgstr "無効な時刻です"
#: colander/__init__.py:1670
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" は time オブジェクトではありません"
#: colander/__init__.py:1795
msgid "Required"
msgstr "必須です"
#: colander/tests/test_colander.py:295 colander/tests/test_colander.py:302
msgid "fail ${val}"
msgstr "失敗 ${val}"
#: colander/tests/test_colander.py:469
msgid "${val}: ${choices}"
msgstr "${val}: ${choices}"
# Dutch translations for colander.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the colander project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.8\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-11-16 14:23+0900\n"
"PO-Revision-Date: 2011-06-03 00:22+0200\n"
"Last-Translator: Tinne Cahy <cahytinne@gmail.com>\n"
"Language-Team: nl <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"Generated-By: Babel 1.3\n"
#: colander/__init__.py:240
msgid "Invalid value"
msgstr "Ongeldige waarde"
#: colander/__init__.py:283
msgid "String does not match expected pattern"
msgstr "Tekst is niet in het juiste formaat"
#: colander/__init__.py:302
msgid "Invalid email address"
msgstr "Ongeldig e-mail adres"
#: colander/__init__.py:330
msgid "${val} is less than minimum value ${min}"
msgstr "${val} is minder dan de minimum waarde ${min}"
#: colander/__init__.py:331
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} is groter dan de maximale toegestane waarde ${max}"
#: colander/__init__.py:363
msgid "Shorter than minimum length ${min}"
msgstr "De minimale lengte is ${min}"
#: colander/__init__.py:369
msgid "Longer than maximum length ${max}"
msgstr "De maximale lengte is ${max}"
#: colander/__init__.py:382
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" is geen toegestane waarde. Kies één van ${choices}."
#: colander/__init__.py:392
msgid "One or more of the choices you made was not acceptable"
msgstr "Één of meer van de keuzes die je maakte zijn niet aanvaardbaar"
#: colander/__init__.py:414 colander/__init__.py:419
#, fuzzy
msgid "\"${val}\" is not a valid credit card number"
msgstr "\"${val}\" is geen geldige kredietkaartnummer"
#: colander/__init__.py:440
msgid "Must be a URL"
msgstr "Moet een URL zijn"
#: colander/__init__.py:536
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" is geen mapping type: ${err}"
#: colander/__init__.py:578
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Onbekende waardes in mapping: \"${val}\""
#: colander/__init__.py:674 colander/__init__.py:905
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" is niet itereerbaar"
#: colander/__init__.py:682
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was ${was})"
msgstr ""
"\"${val}\" bevat niet het juiste aantal elementen (${was} in plaats van ${exp})"
#: colander/__init__.py:821 colander/__init__.py:852
msgid "${cstruct} is not iterable"
msgstr "${cstruct} is niet itereerbaar"
#: colander/__init__.py:1124
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} kan niet worden opgeslagen: ${err}"
#: colander/__init__.py:1142
msgid "${val} is not a string: ${err}"
msgstr "${val} is geen tekst: ${err}"
#: colander/__init__.py:1162 colander/__init__.py:1173
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" is geen getal"
#: colander/__init__.py:1317
msgid "${val} is not a string"
msgstr "${val} is geen tekst"
#: colander/__init__.py:1328
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr "\"${val}\" is niet aanwezig in (${false_choices}) noch aanwezig in (${true_choices})"
#: colander/__init__.py:1388 colander/__init__.py:1405
#: colander/__init__.py:1415
msgid "relative name \"${val}\" irresolveable without package"
msgstr "relatieve aanduiding \"${val}\" kan niet worden opgezocht zonder package"
#: colander/__init__.py:1445
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" heeft geen __name__"
#: colander/__init__.py:1454
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" is geen tekst"
#: colander/__init__.py:1463
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "Kan \"${name}\" niet importeren"
#: colander/__init__.py:1511 colander/__init__.py:1587
msgid "Invalid date"
msgstr "Geen geldige datum"
#: colander/__init__.py:1527
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" is geen datetime object"
#: colander/__init__.py:1598
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" is geen date object"
#: colander/__init__.py:1659
#, fuzzy
msgid "Invalid time"
msgstr "Geen geldige datum"
#: colander/__init__.py:1670
#, fuzzy
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" is geen datetime object"
#: colander/__init__.py:1795
msgid "Required"
msgstr "Verplicht"
#: colander/tests/test_colander.py:295 colander/tests/test_colander.py:302
msgid "fail ${val}"
msgstr "faal ${val}"
#: colander/tests/test_colander.py:469
#, fuzzy
msgid "${val}: ${choices}"
msgstr "\"${val}\" is geen toegestane waarde. Kies één van ${choices}."
# Polish translations for colander.
# Copyright (C) 2011
# This file is distributed under the same license as the colander project.
# FIRST AUTHOR <pigmej@gmail.com>, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.8\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-05-19 13:15+0200\n"
"PO-Revision-Date: 2011-03-17 19:05+0100\n"
"Last-Translator: Jędrzej Nowak <pigmej@gmail.com>\n"
"Language-Team: pl <LL@li.org>\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && "
"(n%100<10 || n%100>=20) ? 1 : 2)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: colander/__init__.py:233
msgid "Invalid value"
msgstr "Niepoprawna wartość"
#: colander/__init__.py:270
msgid "String does not match expected pattern"
msgstr "Nie pasuje do oczekiwanego wzorca"
#: colander/__init__.py:287
msgid "Invalid email address"
msgstr "Niepoprawny adres email"
#: colander/__init__.py:315
msgid "${val} is less than minimum value ${min}"
msgstr "${val} jest mniejsza niż minimalna wartość ${min}"
#: colander/__init__.py:316
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} jest większa niż maksymalna wartość ${max}"
#: colander/__init__.py:348
msgid "Shorter than minimum length ${min}"
msgstr "Krótsze niż minimalna długość ${min}"
#: colander/__init__.py:354
msgid "Longer than maximum length ${max}"
msgstr "Dłuższa niż maksymalna długość ${max}"
#: colander/__init__.py:367
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" nie jest żadnym z ${choices}"
#: colander/__init__.py:377
msgid "One or more of the choices you made was not acceptable"
msgstr ""
#: colander/__init__.py:423
msgid "Must be a URL"
msgstr ""
#: colander/__init__.py:519
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" nie jest zmapowanym typem: ${err}"
#: colander/__init__.py:560
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Nieznane klucze w mapowaniu: \"${val}\""
#: colander/__init__.py:656 colander/__init__.py:856
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" nie jest iterable"
#: colander/__init__.py:664
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was "
"${was})"
msgstr "\"${val}\" ma niepoprawną ilość elementów (oczekiwano ${exp}, było ${was})"
#: colander/__init__.py:803
msgid "${cstruct} is not iterable"
msgstr "${cstruct} nie jest iterable"
#: colander/__init__.py:1075
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} nie może zostać zserializowana: ${err}"
#: colander/__init__.py:1093
msgid "${val} is not a string: ${err}"
msgstr "${val} nie jest stringiem: ${err}"
#: colander/__init__.py:1113 colander/__init__.py:1124
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" nie jest liczbą"
#: colander/__init__.py:1268
msgid "${val} is not a string"
msgstr "${val} nie jest stringiem"
#: colander/__init__.py:1279
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr ""
#: colander/__init__.py:1339 colander/__init__.py:1356
#: colander/__init__.py:1366
msgid "relative name \"${val}\" irresolveable without package"
msgstr ""
#: colander/__init__.py:1396
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" nie ma __name__"
#: colander/__init__.py:1405
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" nie jest stringiem"
#: colander/__init__.py:1414
msgid "The dotted name \"${name}\" cannot be imported"
msgstr ""
#: colander/__init__.py:1462 colander/__init__.py:1538
msgid "Invalid date"
msgstr "Niepoprawna data"
#: colander/__init__.py:1478
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" nie jest obiektem datetime"
#: colander/__init__.py:1549
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" nie jest obiektem date"
#: colander/__init__.py:1610
#, fuzzy
#| msgid "Invalid date"
msgid "Invalid time"
msgstr "Niepoprawna data"
#: colander/__init__.py:1621
#, fuzzy
#| msgid "\"${val}\" is not a datetime object"
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" nie jest obiektem datetime"
#: colander/__init__.py:1878 colander/__init__.py:1880
msgid "Required"
msgstr "Wymagane"
# Portuguese translations for colander.
# Copyright (C) 2012
# This file is distributed under the same license as the colander project.
# Nuno Teixeira <teixas@gmail.com>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.9.7\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-05-19 13:15+0200\n"
"PO-Revision-Date: 2012-06-30 17:48+0100\n"
"Last-Translator: Nuno Teixeira <teixas@gmail.com>\n"
"Language-Team: pt <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: colander/__init__.py:233
msgid "Invalid value"
msgstr "Valor inválido"
#: colander/__init__.py:270
msgid "String does not match expected pattern"
msgstr "Os caracteres não seguem o padrão"
#: colander/__init__.py:287
msgid "Invalid email address"
msgstr "E-mail inválido"
#: colander/__init__.py:315
msgid "${val} is less than minimum value ${min}"
msgstr "${val} é menor que o valor mínimo ${min}"
#: colander/__init__.py:316
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} é maior que o valor máximo ${max}"
#: colander/__init__.py:348
msgid "Shorter than minimum length ${min}"
msgstr "Menor que o tamanho mínimo ${min}"
#: colander/__init__.py:354
msgid "Longer than maximum length ${max}"
msgstr "Maior que o tamanho máximo ${max}"
#: colander/__init__.py:367
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" não se encontra em ${choices}"
#: colander/__init__.py:377
msgid "One or more of the choices you made was not acceptable"
msgstr ""
#: colander/__init__.py:423
msgid "Must be a URL"
msgstr ""
#: colander/__init__.py:519
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" não suporta mapeamento: ${err}"
#: colander/__init__.py:560
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Índice inexistente no mapeamento: \"${val}\""
#: colander/__init__.py:656 colander/__init__.py:856
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" não é iterável"
#: colander/__init__.py:664
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was "
"${was})"
msgstr ""
"\"${val}\" tem o número incorrecto de elementos (esperam-se ${exp}, mas "
"mas existem ${was})"
#: colander/__init__.py:803
msgid "${cstruct} is not iterable"
msgstr "${cstruct} não é iterável"
#: colander/__init__.py:1075
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} não pode ser serializado: ${err}"
#: colander/__init__.py:1093
msgid "${val} is not a string: ${err}"
msgstr "${val} não é uma cadeia de caracteres: ${err}"
#: colander/__init__.py:1113 colander/__init__.py:1124
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" não é um número"
#: colander/__init__.py:1268
msgid "${val} is not a string"
msgstr "${val} não é uma cadeia de caracteres"
#: colander/__init__.py:1279
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr ""
#: colander/__init__.py:1339 colander/__init__.py:1356
#: colander/__init__.py:1366
msgid "relative name \"${val}\" irresolveable without package"
msgstr "O nome relativo \"${val}\" não pode ser resolvido sem o nome do pacote"
#: colander/__init__.py:1396
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" não contém __name___"
#: colander/__init__.py:1405
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" não é uma cadeia de caracteres"
#: colander/__init__.py:1414
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "O nome \"${name}\" não pode ser importado"
#: colander/__init__.py:1462 colander/__init__.py:1538
msgid "Invalid date"
msgstr "Data inválida"
#: colander/__init__.py:1478
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" não é um objecto datetime"
#: colander/__init__.py:1549
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" não é um objecto date"
#: colander/__init__.py:1610
msgid "Invalid time"
msgstr "Hora inválida"
#: colander/__init__.py:1621
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" não é um objecto time"
#: colander/__init__.py:1878 colander/__init__.py:1880
msgid "Required"
msgstr "Obrigatório"
# Portuguese (Brazil) translations for colander.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the colander project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
# Nando Florestan <nandoflorestan@gmail.com>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.5.2\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-05-19 13:15+0200\n"
"PO-Revision-Date: 2012-03-20 23:28-0300\n"
"Last-Translator: Nando Florestan <nandoflorestan@gmail.com>\n"
"Language-Team: Portuguese <>\n"
"Plural-Forms: nplurals=2; plural=(n!=1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: colander/__init__.py:233
msgid "Invalid value"
msgstr "Valor inválido"
#: colander/__init__.py:270
msgid "String does not match expected pattern"
msgstr "Não corresponde ao padrão esperado"
#: colander/__init__.py:287
msgid "Invalid email address"
msgstr "Endereço de email inválido"
#: colander/__init__.py:315
msgid "${val} is less than minimum value ${min}"
msgstr "${val} é menor do que o mínimo ${min}"
#: colander/__init__.py:316
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} é maior do que o máximo ${max}"
#: colander/__init__.py:348
msgid "Shorter than minimum length ${min}"
msgstr "Mais curto do que o comprimento mínimo ${min}"
#: colander/__init__.py:354
msgid "Longer than maximum length ${max}"
msgstr "Mais longo do que o comprimento máximo ${max}"
#: colander/__init__.py:367
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" não está entre ${choices}"
#: colander/__init__.py:377
msgid "One or more of the choices you made was not acceptable"
msgstr ""
#: colander/__init__.py:423
msgid "Must be a URL"
msgstr ""
#: colander/__init__.py:519
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" não é um tipo de mapeamento: ${err}"
#: colander/__init__.py:560
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Chaves desconhecidas no mapeamento: \"${val}\""
#: colander/__init__.py:656 colander/__init__.py:856
msgid "\"${val}\" is not iterable"
msgstr "Iterações não podem ser feitas em \"${val}\""
#: colander/__init__.py:664
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was "
"${was})"
msgstr ""
"\"${val}\" tem um número incorreto de elementos (${exp} esperados, ${was}"
" obtidos)"
#: colander/__init__.py:803
msgid "${cstruct} is not iterable"
msgstr "Iterações não podem ser feitas em ${cstruct}"
#: colander/__init__.py:1075
msgid "${val} cannot be serialized: ${err}"
msgstr "\"${val} não pode ser serializado: ${err}"
#: colander/__init__.py:1093
msgid "${val} is not a string: ${err}"
msgstr "${val} não é uma string: %{err}"
#: colander/__init__.py:1113 colander/__init__.py:1124
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" não é um número"
#: colander/__init__.py:1268
msgid "${val} is not a string"
msgstr "${val} não é uma string"
#: colander/__init__.py:1279
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr ""
#: colander/__init__.py:1339 colander/__init__.py:1356
#: colander/__init__.py:1366
msgid "relative name \"${val}\" irresolveable without package"
msgstr "O nome relativo \"${val}\" não pode ser resolvido sem o pacote"
#: colander/__init__.py:1396
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" não tem __name__"
#: colander/__init__.py:1405
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" não é uma string"
#: colander/__init__.py:1414
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "O pacote \"${name}\" não pode ser importado"
#: colander/__init__.py:1462 colander/__init__.py:1538
msgid "Invalid date"
msgstr "Data inválida"
#: colander/__init__.py:1478
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" não é um objeto datetime"
#: colander/__init__.py:1549
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" não é um objeto date"
#: colander/__init__.py:1610
msgid "Invalid time"
msgstr "Hora inválida"
#: colander/__init__.py:1621
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" não é um objeto time"
#: colander/__init__.py:1878 colander/__init__.py:1880
msgid "Required"
msgstr "Obrigatório"
#~ msgid "\"${val}\" is required but missing"
#~ msgstr "\"${val}\" é obrigatório, mas está vazio"
#~ msgid "${val} cannot be parsed as an iso8601 date: ${err}"
#~ msgstr "${val} não pode ser entendido como uma data iso8601: ${err}"
# Romanian (î/sînt) translations for colander.
# Copyright (C) 2013 ORGANIZATION
# This file is distributed under the same license as the colander project.
#
# Sergiu Bivol <sergiu@cip.md>, 2016.
msgid ""
msgstr ""
"Project-Id-Version: colander 1.0b1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-11-16 14:23+0900\n"
"PO-Revision-Date: 2016-04-23 14:23+0300\n"
"Last-Translator: Sergiu Bivol <sergiu@cip.md>\n"
"Language-Team: Romanian <kde-i18n-ro@kde.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
"Language: ro\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < "
"20)) ? 1 : 2;\n"
"X-Generator: Lokalize 1.5\n"
#: colander/__init__.py:240
msgid "Invalid value"
msgstr "Valoare nevalidă"
#: colander/__init__.py:283
msgid "String does not match expected pattern"
msgstr "Șirul nu se potrivește cu modelul așteptat"
#: colander/__init__.py:302
msgid "Invalid email address"
msgstr "Adresă email nevalidă"
#: colander/__init__.py:330
msgid "${val} is less than minimum value ${min}"
msgstr "${val} e mai mică decît valoarea minimă ${min}"
#: colander/__init__.py:331
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} e mai mare decît valoarea maximă ${max}"
#: colander/__init__.py:363
msgid "Shorter than minimum length ${min}"
msgstr "Mai scurt decît lungimea minimă ${min}"
#: colander/__init__.py:369
msgid "Longer than maximum length ${max}"
msgstr "Mai lung decît lungimea maximă ${max}"
#: colander/__init__.py:382
msgid "\"${val}\" is not one of ${choices}"
msgstr "„${val}” nu e una dintre ${choice}"
#: colander/__init__.py:392
msgid "One or more of the choices you made was not acceptable"
msgstr "Una sau mai multe dintre alegerile făcute nu erau acceptabile"
#: colander/__init__.py:414 colander/__init__.py:419
msgid "\"${val}\" is not a valid credit card number"
msgstr "„${val}” nu e număr valid de carte de credit"
#: colander/__init__.py:440
msgid "Must be a URL"
msgstr "Trebuie să fie URL"
#: colander/__init__.py:536
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "„${val}” nu e tip de corespondență: ${err}"
#: colander/__init__.py:578
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Chei nerecunoscute în corespondență: „${val}”"
#: colander/__init__.py:674 colander/__init__.py:905
msgid "\"${val}\" is not iterable"
msgstr "„${val}” nu e iterabilă"
#: colander/__init__.py:682
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was ${was})"
msgstr ""
"„${val}” are număr greșit de elemente (se așteptau ${exp}, erau ${was})"
#: colander/__init__.py:821 colander/__init__.py:852
msgid "${cstruct} is not iterable"
msgstr "${cstruct} nu e iterabilă"
#: colander/__init__.py:1124
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} nu poate fi serializată: ${err}"
#: colander/__init__.py:1142
msgid "${val} is not a string: ${err}"
msgstr "${val} nu e șir: ${err}"
#: colander/__init__.py:1162 colander/__init__.py:1173
msgid "\"${val}\" is not a number"
msgstr "„${val}” nu e număr"
#: colander/__init__.py:1317
msgid "${val} is not a string"
msgstr "${val} nu e șir"
#: colander/__init__.py:1328
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr "„${val}” nu e nici în (${false_choices}), nici în (${true_choices})"
#: colander/__init__.py:1388 colander/__init__.py:1405 colander/__init__.py:1415
msgid "relative name \"${val}\" irresolveable without package"
msgstr "denumirea relativă „${val}” nu e rezolvabilă fără pachet"
#: colander/__init__.py:1445
msgid "\"${val}\" has no __name__"
msgstr "„${val}” nu are __name__"
#: colander/__init__.py:1454
msgid "\"${val}\" is not a string"
msgstr "„${val}” nu e șir"
#: colander/__init__.py:1463
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "Denumirea punctată „${name}” nu poate fi importată"
#: colander/__init__.py:1511 colander/__init__.py:1587
msgid "Invalid date"
msgstr "Dată nevalidă"
#: colander/__init__.py:1527
msgid "\"${val}\" is not a datetime object"
msgstr "„${val}” nu e obiect „datetime”"
#: colander/__init__.py:1598
msgid "\"${val}\" is not a date object"
msgstr "„${val}” nu e obiect „date”"
#: colander/__init__.py:1659
msgid "Invalid time"
msgstr "Oră nevalidă"
#: colander/__init__.py:1670
msgid "\"${val}\" is not a time object"
msgstr "„${val}” nu e obiect „time”"
#: colander/__init__.py:1795
msgid "Required"
msgstr "Necesar"
#: colander/tests/test_colander.py:295 colander/tests/test_colander.py:302
msgid "fail ${val}"
msgstr "eșuează ${val}"
#: colander/tests/test_colander.py:469
msgid "${val}: ${choices}"
msgstr "${val}: ${choices}"
# Russian translations for colander.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the colander project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.5.2\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-05-19 13:15+0200\n"
"PO-Revision-Date: 2010-04-25 21:18-0400\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: ru <LL@li.org>\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: colander/__init__.py:233
msgid "Invalid value"
msgstr "Неверное значение"
#: colander/__init__.py:270
msgid "String does not match expected pattern"
msgstr "Строка не соответствует заданному шаблону"
#: colander/__init__.py:287
msgid "Invalid email address"
msgstr "Неверный адрес электронной почты"
#: colander/__init__.py:315
msgid "${val} is less than minimum value ${min}"
msgstr "${val} меньше чем ${min}"
#: colander/__init__.py:316
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} больше чем ${max}"
#: colander/__init__.py:348
msgid "Shorter than minimum length ${min}"
msgstr "Меньше, чем минимальная длина {$min}"
#: colander/__init__.py:354
msgid "Longer than maximum length ${max}"
msgstr "Больше, чем максимальная длина ${max}"
#: colander/__init__.py:367
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" не является одним из ${choices}"
#: colander/__init__.py:377
msgid "One or more of the choices you made was not acceptable"
msgstr ""
#: colander/__init__.py:423
msgid "Must be a URL"
msgstr ""
#: colander/__init__.py:519
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" содержит неверный тип данных: ${err}"
#: colander/__init__.py:560
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Неизвестные ключи: \"${val}\""
#: colander/__init__.py:656 colander/__init__.py:856
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" не является итератором"
#: colander/__init__.py:664
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was "
"${was})"
msgstr ""
"\"${val}\" содержит неверное число элементов (ожидалось ${exp}, но "
"содержит ${was})"
#: colander/__init__.py:803
msgid "${cstruct} is not iterable"
msgstr "${cstruct} не является итератором"
#: colander/__init__.py:1075
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} не может быть сериализовано в строку: ${err}"
#: colander/__init__.py:1093
msgid "${val} is not a string: ${err}"
msgstr "${val} не является строкой: ${err}"
#: colander/__init__.py:1113 colander/__init__.py:1124
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" не является числом"
#: colander/__init__.py:1268
msgid "${val} is not a string"
msgstr "${val} не является строкой"
#: colander/__init__.py:1279
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr ""
#: colander/__init__.py:1339 colander/__init__.py:1356
#: colander/__init__.py:1366
msgid "relative name \"${val}\" irresolveable without package"
msgstr ""
#: colander/__init__.py:1396
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" не имеет аттрибута __name__"
#: colander/__init__.py:1405
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" не является строкой"
#: colander/__init__.py:1414
msgid "The dotted name \"${name}\" cannot be imported"
msgstr ""
#: colander/__init__.py:1462 colander/__init__.py:1538
#, fuzzy
#| msgid "Invalid value"
msgid "Invalid date"
msgstr "Неверное значение"
#: colander/__init__.py:1478
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" не является объектом datetime"
#: colander/__init__.py:1549
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" не является объектом date"
#: colander/__init__.py:1610
#, fuzzy
#| msgid "Invalid value"
msgid "Invalid time"
msgstr "Неверное значение"
#: colander/__init__.py:1621
#, fuzzy
#| msgid "\"${val}\" is not a datetime object"
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" не является объектом datetime"
#: colander/__init__.py:1878 colander/__init__.py:1880
msgid "Required"
msgstr "Требуется"
#~ msgid "\"${val}\" is required but missing"
#~ msgstr "\"${val}\" является обязательным для заполнения"
#~ msgid "${val} cannot be parsed as an iso8601 date: ${err}"
#~ msgstr ""
#~ "Значение ${val} не может быть распознано"
#~ " как дата в формате iso8601: ${err}"
# Swedish translations for colander.
# Copyright (C) 2010 ORGANIZATION
# This file is distributed under the same license as the colander project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.8\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-05-19 13:15+0200\n"
"PO-Revision-Date: 2011-08-23 10:04+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: sv <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: colander/__init__.py:233
msgid "Invalid value"
msgstr "Ogiltigt värde"
#: colander/__init__.py:270
msgid "String does not match expected pattern"
msgstr "Strängen följer inte förväntat mönster"
#: colander/__init__.py:287
msgid "Invalid email address"
msgstr "Ogiltig epostadress"
#: colander/__init__.py:315
msgid "${val} is less than minimum value ${min}"
msgstr "${val} är mindre än minimumvärdet ${min}"
#: colander/__init__.py:316
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} är större än maxvärdet ${max}"
#: colander/__init__.py:348
msgid "Shorter than minimum length ${min}"
msgstr "Kortare än minimilängden ${min}"
#: colander/__init__.py:354
msgid "Longer than maximum length ${max}"
msgstr "Längre än maxlängden ${max}"
#: colander/__init__.py:367
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" är inte en av ${choices}"
#: colander/__init__.py:377
msgid "One or more of the choices you made was not acceptable"
msgstr ""
#: colander/__init__.py:423
msgid "Must be a URL"
msgstr ""
#: colander/__init__.py:519
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" är inte en \"mapping\"-typ: ${err}"
#: colander/__init__.py:560
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "Obekant nyckel i \"mapping\": \"${val}\""
#: colander/__init__.py:656 colander/__init__.py:856
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" är inte itererbar"
#: colander/__init__.py:664
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was "
"${was})"
msgstr "\"${val}\" har fel antal element (förväntade ${exp}, var ${was})"
#: colander/__init__.py:803
msgid "${cstruct} is not iterable"
msgstr "${cstruct} är inte itererbar"
#: colander/__init__.py:1075
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} kan inte serialiseras: ${err}"
#: colander/__init__.py:1093
msgid "${val} is not a string: ${err}"
msgstr "${val} är inte en sträng: ${err}"
#: colander/__init__.py:1113 colander/__init__.py:1124
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" är inte ett nummer"
#: colander/__init__.py:1268
msgid "${val} is not a string"
msgstr "${val} är inte en sträng"
#: colander/__init__.py:1279
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr ""
#: colander/__init__.py:1339 colander/__init__.py:1356
#: colander/__init__.py:1366
msgid "relative name \"${val}\" irresolveable without package"
msgstr "relativa namnet \"${val}\" kan inte slås upp utan paket"
#: colander/__init__.py:1396
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" har ingen __name__"
#: colander/__init__.py:1405
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" är inte en sträng"
#: colander/__init__.py:1414
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "Punktade namnet \"${name}\" kan inte importeras"
#: colander/__init__.py:1462 colander/__init__.py:1538
msgid "Invalid date"
msgstr "Ogiltigt datum"
#: colander/__init__.py:1478
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" är inte ett \"datetime\"-objekt"
#: colander/__init__.py:1549
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" är inte ett \"date\"-objekt"
#: colander/__init__.py:1610
#, fuzzy
#| msgid "Invalid date"
msgid "Invalid time"
msgstr "Ogiltigt datum"
#: colander/__init__.py:1621
#, fuzzy
#| msgid "\"${val}\" is not a datetime object"
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" är inte ett \"datetime\"-objekt"
#: colander/__init__.py:1878 colander/__init__.py:1880
msgid "Required"
msgstr "Krävd"
# Simplified Chinese translations for colander.
# This file is distributed under the same license as the colander project.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.8\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-05-19 13:15+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: zh <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\n"
#: colander/__init__.py:233
msgid "Invalid value"
msgstr "无效值"
#: colander/__init__.py:270
msgid "String does not match expected pattern"
msgstr "字符串和要求的模式不匹配"
#: colander/__init__.py:287
msgid "Invalid email address"
msgstr "无效的邮件地址"
#: colander/__init__.py:315
msgid "${val} is less than minimum value ${min}"
msgstr "${val} 低于最低限值 ${min}"
#: colander/__init__.py:316
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} 大于最高限值 ${max}"
#: colander/__init__.py:348
msgid "Shorter than minimum length ${min}"
msgstr "短于最小长度 ${min}"
#: colander/__init__.py:354
msgid "Longer than maximum length ${max}"
msgstr "长于最大长度 ${max}"
#: colander/__init__.py:367
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" 不是这些值 ${choices} 中的一个"
#: colander/__init__.py:377
msgid "One or more of the choices you made was not acceptable"
msgstr ""
#: colander/__init__.py:423
msgid "Must be a URL"
msgstr ""
#: colander/__init__.py:519
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" 不是一个映射类型: ${err}"
#: colander/__init__.py:560
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "无法识别的键: \"${val}\""
#: colander/__init__.py:656 colander/__init__.py:856
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" 不可遍历"
#: colander/__init__.py:664
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was "
"${was})"
msgstr "\"${val}\" 的元素个数不正确 (要求 ${exp}, 实际 ${was})"
#: colander/__init__.py:803
msgid "${cstruct} is not iterable"
msgstr "${cstruct} 不可遍历"
#: colander/__init__.py:1075
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} 不可序列化: ${err}"
#: colander/__init__.py:1093
msgid "${val} is not a string: ${err}"
msgstr "${val} 不是字符串: ${err}"
#: colander/__init__.py:1113 colander/__init__.py:1124
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" 不是数字"
#: colander/__init__.py:1268
msgid "${val} is not a string"
msgstr "${val} 不是字符串"
#: colander/__init__.py:1279
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr ""
#: colander/__init__.py:1339 colander/__init__.py:1356
#: colander/__init__.py:1366
msgid "relative name \"${val}\" irresolveable without package"
msgstr "相关名字 \"${val}\" 无法找到"
#: colander/__init__.py:1396
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" 没有 __name__"
#: colander/__init__.py:1405
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" 不是字符串"
#: colander/__init__.py:1414
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "点名字 \"${name}\" 无法导入"
#: colander/__init__.py:1462 colander/__init__.py:1538
msgid "Invalid date"
msgstr "无效日期"
#: colander/__init__.py:1478
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" 不是一个时间日期对象"
#: colander/__init__.py:1549
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" 不是一个日期对象"
#: colander/__init__.py:1610
#, fuzzy
#| msgid "Invalid date"
msgid "Invalid time"
msgstr "无效日期"
#: colander/__init__.py:1621
#, fuzzy
#| msgid "\"${val}\" is not a datetime object"
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" 不是一个时间日期对象"
#: colander/__init__.py:1878 colander/__init__.py:1880
msgid "Required"
msgstr "必需"
# Chinese (Traditional) translations for colander.
# While this is meant to be a traditional chinese translation, since it was done
# By someone from Taiwan, it might have regional specialites.
# This file is distributed under the same license as the colander project.
#
msgid ""
msgstr ""
"Project-Id-Version: colander 0.8\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-09-18 22:57+0200\n"
"PO-Revision-Date: 2017-03-21 11:07+0100\n"
"Last-Translator: \n"
"Language-Team: zh_Hant\n"
"Language: zh_Hant\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Generated-By: Babel 1.3\n"
"X-Generator: Poedit 1.8.12\n"
#: colander/__init__.py:294
msgid "Invalid value"
msgstr "無效值"
#: colander/__init__.py:340
msgid "String does not match expected pattern"
msgstr "字符串和要求的模式不匹配"
#: colander/__init__.py:359
msgid "Invalid email address"
msgstr "無效的郵件地址"
#: colander/__init__.py:387
msgid "${val} is less than minimum value ${min}"
msgstr "${val} 低於最低限值 ${min}"
#: colander/__init__.py:388
msgid "${val} is greater than maximum value ${max}"
msgstr "${val} 大於最高限值 ${max}"
#: colander/__init__.py:435
msgid "Shorter than minimum length ${min}"
msgstr "短於最小長度 ${min}"
#: colander/__init__.py:436
msgid "Longer than maximum length ${max}"
msgstr "長於最大長度 ${max}"
#: colander/__init__.py:464
msgid "\"${val}\" is not one of ${choices}"
msgstr "\"${val}\" 不是這些值 ${choices} 中的一個"
#: colander/__init__.py:479
msgid "\"${val}\" must not be one of ${choices}"
msgstr "\"${val}\" 不能是 ${choices}"
#: colander/__init__.py:501
msgid "One or more of the choices you made was not acceptable"
msgstr "您做出的一個或多個選擇是不可接受的"
#: colander/__init__.py:523 colander/__init__.py:528
msgid "\"${val}\" is not a valid credit card number"
msgstr "\"${val}\" 不是有效的信用卡號碼"
#: colander/__init__.py:549
msgid "Must be a URL"
msgstr "必須是網址"
#: colander/__init__.py:553
msgid "Invalid UUID string"
msgstr "UUID 字符串無效"
#: colander/__init__.py:650
msgid "\"${val}\" is not a mapping type: ${err}"
msgstr "\"${val}\" 不是一個映射類型: ${err}"
#: colander/__init__.py:694
msgid "Unrecognized keys in mapping: \"${val}\""
msgstr "無法識別的鍵: \"${val}\""
#: colander/__init__.py:789 colander/__init__.py:1020
msgid "\"${val}\" is not iterable"
msgstr "\"${val}\" 不可迭代"
#: colander/__init__.py:797
msgid ""
"\"${val}\" has an incorrect number of elements (expected ${exp}, was ${was})"
msgstr "\"${val}\" 的元素個數不正確 (要求 ${exp}, 實際 ${was})"
#: colander/__init__.py:936 colander/__init__.py:967
msgid "${cstruct} is not iterable"
msgstr "${cstruct} 不可迭代"
#: colander/__init__.py:1254
msgid "${val} cannot be serialized: ${err}"
msgstr "${val} 不可序列化: ${err}"
#: colander/__init__.py:1275
msgid "${val} is not a string: ${err}"
msgstr "${val} 不是字符串: ${err}"
#: colander/__init__.py:1295 colander/__init__.py:1306
msgid "\"${val}\" is not a number"
msgstr "\"${val}\" 不是數字"
#: colander/__init__.py:1454
msgid "${val} is not a string"
msgstr "${val} 不是字符串"
#: colander/__init__.py:1465
msgid "\"${val}\" is neither in (${false_choices}) nor in (${true_choices})"
msgstr ""
#: colander/__init__.py:1525 colander/__init__.py:1542
#: colander/__init__.py:1552
msgid "relative name \"${val}\" irresolveable without package"
msgstr "相關名字 \"${val}\" 無法找到"
#: colander/__init__.py:1582
msgid "\"${val}\" has no __name__"
msgstr "\"${val}\" 没有 __name__"
#: colander/__init__.py:1591
msgid "\"${val}\" is not a string"
msgstr "\"${val}\" 不是字符串"
#: colander/__init__.py:1600
msgid "The dotted name \"${name}\" cannot be imported"
msgstr "點名字 \"${name}\" 無法匯入"
#: colander/__init__.py:1648 colander/__init__.py:1722
msgid "Invalid date"
msgstr "無效日期"
#: colander/__init__.py:1662
msgid "\"${val}\" is not a datetime object"
msgstr "\"${val}\" 不是一個時間日期對象"
#: colander/__init__.py:1733
msgid "\"${val}\" is not a date object"
msgstr "\"${val}\" 不是一個日期對象"
#: colander/__init__.py:1794
msgid "Invalid time"
msgstr "時間無效"
#: colander/__init__.py:1804
msgid "\"${val}\" is not a time object"
msgstr "\"${val}\" 不是時間對象"
#: colander/tests/test_colander.py:334 colander/tests/test_colander.py:341
msgid "fail ${val}"
msgstr ""
#: colander/tests/test_colander.py:537
msgid "${val}: ${choices}"
msgstr "${val} ${choices}"
This diff could not be displayed because it is too large.
def test_interfaces():
from colander import interfaces
import unittest
import datetime
class Test_Utc(unittest.TestCase):
def _makeOne(self):
from ..iso8601 import Utc
return Utc()
def test_utcoffset(self):
from ..iso8601 import ZERO
inst = self._makeOne()
result = inst.utcoffset(None)
self.assertEqual(result, ZERO)
def test_tzname(self):
inst = self._makeOne()
result = inst.tzname(None)
self.assertEqual(result, "UTC")
def test_dst(self):
from ..iso8601 import ZERO
inst = self._makeOne()
result = inst.dst(None)
self.assertEqual(result, ZERO)
def test_picklability(self):
from ..iso8601 import ZERO
from ..compat import loads, dumps, HIGHEST_PROTOCOL
inst = self._makeOne()
for protocol in range(HIGHEST_PROTOCOL + 1):
inst2 = loads(dumps(inst, protocol))
self.assertEqual(inst2.utcoffset(None), ZERO)
self.assertEqual(inst2.tzname(None), 'UTC')
self.assertEqual(inst2.dst(None), ZERO)
class Test_FixedOffset(unittest.TestCase):
def _makeOne(self):
from ..iso8601 import FixedOffset
return FixedOffset(1, 30, 'oneandahalf')
def test_utcoffset(self):
inst = self._makeOne()
result = inst.utcoffset(None)
self.assertEqual(result, datetime.timedelta(hours=1, minutes=30))
def test_tzname(self):
inst = self._makeOne()
result = inst.tzname(None)
self.assertEqual(result, 'oneandahalf')
def test_dst(self):
from ..iso8601 import ZERO
inst = self._makeOne()
result = inst.dst(None)
self.assertEqual(result, ZERO)
def test_picklability(self):
from ..iso8601 import ZERO
from ..compat import loads, dumps, HIGHEST_PROTOCOL
inst = self._makeOne()
for protocol in range(HIGHEST_PROTOCOL + 1):
inst2 = loads(dumps(inst, protocol))
self.assertEqual(inst2.utcoffset(None),
datetime.timedelta(hours=1, minutes=30))
self.assertEqual(inst2.tzname(None), 'oneandahalf')
self.assertEqual(inst2.dst(None), ZERO)
def test___repr__(self):
inst = self._makeOne()
result = inst.__repr__()
self.assertEqual(result, "<FixedOffset 'oneandahalf' datetime.timedelta(0, 5400)>")
class Test_parse_timezone(unittest.TestCase):
def _callFUT(self, tzstring, **kw):
# mimic old parse_timezone() by returning a FixedOffset
from datetime import tzinfo
from ..iso8601 import (parse_date, FixedOffset)
if tzstring is None:
tzstring = ''
dt = parse_date("2006-10-11T00:14:33{0}".format(tzstring), **kw)
return dt.tzinfo
def test_default_Z(self):
from ..iso8601 import UTC
result = self._callFUT('Z')
self.assertEqual(result, UTC)
def test_Z_with_default_timezone(self):
from ..iso8601 import UTC, FixedOffset
tz = FixedOffset(1, 0, 'myname')
result = self._callFUT('Z', default_timezone=tz)
self.assertEqual(result, UTC)
def test_default_None(self):
from ..iso8601 import UTC
result = self._callFUT(None)
self.assertEqual(result, UTC)
def test_None_with_default_timezone(self):
from ..iso8601 import FixedOffset
tz = FixedOffset(1, 0, 'myname')
result = self._callFUT(None, default_timezone=tz)
self.assertEqual(result, tz)
def test_positive(self):
tzstring = "+01:00"
result = self._callFUT(tzstring)
self.assertEqual(result.utcoffset(None),
datetime.timedelta(hours=1, minutes=0))
def test_positive_without_colon(self):
tzstring = "+0100"
result = self._callFUT(tzstring)
self.assertEqual(result.utcoffset(None),
datetime.timedelta(hours=1, minutes=0))
def test_positive_without_minutes(self):
tzstring = "+01"
result = self._callFUT(tzstring)
self.assertEqual(result.utcoffset(None),
datetime.timedelta(hours=1, minutes=0))
def test_negative(self):
tzstring = "-01:00"
result = self._callFUT(tzstring)
self.assertEqual(result.utcoffset(None),
datetime.timedelta(hours=-1, minutes=0))
def test_negative_without_colon(self):
tzstring = "-0100"
result = self._callFUT(tzstring)
self.assertEqual(result.utcoffset(None),
datetime.timedelta(hours=-1, minutes=0))
def test_negative_without_minutes(self):
tzstring = "-01"
result = self._callFUT(tzstring)
self.assertEqual(result.utcoffset(None),
datetime.timedelta(hours=-1, minutes=0))
class Test_parse_date(unittest.TestCase):
def _callFUT(self, datestring):
from ..iso8601 import parse_date
return parse_date(datestring)
def test_notastring(self):
from ..iso8601 import ParseError
self.assertRaises(ParseError, self._callFUT, None)
def test_cantparse(self):
from ..iso8601 import ParseError
self.assertRaises(ParseError, self._callFUT, 'garbage')
def test_outfrange(self):
from ..iso8601 import ParseError
self.assertRaises(ParseError, self._callFUT, '2013-05-32')
def test_normal(self):
from ..iso8601 import UTC
result = self._callFUT("2007-01-25T12:00:00Z")
self.assertEqual(result,
datetime.datetime(2007, 1, 25, 12, 0, tzinfo=UTC))
def test_fraction(self):
from ..iso8601 import UTC
result = self._callFUT("2007-01-25T12:00:00.123Z")
self.assertEqual(result,
datetime.datetime(2007, 1, 25, 12, 0, 0, 123000,
tzinfo=UTC))
def test_no_seconds(self):
from ..iso8601 import UTC
result = self._callFUT("2007-01-25T12:00Z")
self.assertEqual(result,
datetime.datetime(2007, 1, 25, 12, 0, 0, 0,
tzinfo=UTC))
def test_no_minutes(self):
from ..iso8601 import UTC
result = self._callFUT("2007-01-25T12Z")
self.assertEqual(result,
datetime.datetime(2007, 1, 25, 12, 0, 0, 0,
tzinfo=UTC))
def test_no_hours(self):
from ..iso8601 import UTC
result = self._callFUT("2007-01-25")
self.assertEqual(result,
datetime.datetime(2007, 1, 25, 0, 0, 0, 0,
tzinfo=UTC))
def test_slash_separated_raises_ParseError(self):
from ..iso8601 import ParseError
self.assertRaises(ParseError, self._callFUT, "2007/01/25")
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!