You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(10) |
Dec
(4) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(1) |
Feb
(8) |
Mar
(8) |
Apr
(4) |
May
(19) |
Jun
(1) |
Jul
(1) |
Aug
(18) |
Sep
(18) |
Oct
(19) |
Nov
(75) |
Dec
(80) |
| 2006 |
Jan
(86) |
Feb
(61) |
Mar
(60) |
Apr
(47) |
May
(39) |
Jun
(16) |
Jul
(30) |
Aug
(13) |
Sep
(13) |
Oct
(21) |
Nov
(1) |
Dec
(10) |
| 2007 |
Jan
(2) |
Feb
(7) |
Mar
(9) |
Apr
(3) |
May
(9) |
Jun
(4) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
(12) |
Nov
(1) |
Dec
(7) |
| 2008 |
Jan
|
Feb
(2) |
Mar
(14) |
Apr
(9) |
May
(23) |
Jun
(4) |
Jul
|
Aug
(13) |
Sep
(8) |
Oct
(15) |
Nov
(40) |
Dec
(14) |
| 2009 |
Jan
|
Feb
(4) |
Mar
(10) |
Apr
(2) |
May
(2) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <sub...@co...> - 2008-03-27 15:24:16
|
Author: ianb Date: 2008-03-27 09:24:17 -0600 (Thu, 27 Mar 2008) New Revision: 3363 Modified: FormEncode/trunk/docs/news.txt Log: added languages to old news Modified: FormEncode/trunk/docs/news.txt =================================================================== --- FormEncode/trunk/docs/news.txt 2008-03-27 15:21:43 UTC (rev 3362) +++ FormEncode/trunk/docs/news.txt 2008-03-27 15:24:17 UTC (rev 3363) @@ -26,6 +26,8 @@ * While something like ``Int.to_python()`` worked, other methods like ``Int.message(...)`` didn't work. Now it does. +* Added Italian, Finnish, and Norwegian translations. + 0.9 --- |
|
From: <sub...@co...> - 2008-03-27 15:21:44
|
Author: ianb Date: 2008-03-27 09:21:43 -0600 (Thu, 27 Mar 2008) New Revision: 3362 Removed: FormEncode/trunk/docs/form-generation-example/ FormEncode/trunk/docs/form-generation.txt Log: didn't mean to commit those docs Deleted: FormEncode/trunk/docs/form-generation.txt =================================================================== --- FormEncode/trunk/docs/form-generation.txt 2008-03-27 15:20:54 UTC (rev 3361) +++ FormEncode/trunk/docs/form-generation.txt 2008-03-27 15:21:43 UTC (rev 3362) @@ -1,16 +0,0 @@ -Form Generation with FormEncode and htmlfill -++++++++++++++++++++++++++++++++++++++++++++ - -.. contents:: - -Introduction -============ - -This is a tutorial to teach you how to do form generation using FormEncode for `validation <Validation.html>`_, and `htmlfill <htmlfill.html>`_ for filling the forms, together with your own ad hoc code to generate the HTML. - -This tutorial does not use a framework, as several frameworks that use FormEncode have their own wrappers for invoking validation. These wrappers are typically closely bound to the framework and cover up some of the steps. While this is fine and those wrappers are useful, they could be distracting in this example. A very simple framework using `WebOb <http://pythonpaste.org/webob/>`_ is used in these examples. For templating `Tempita <http://pythonpaste.org/tempita/>`_ will be used. - -The example itself is a simple CRUD framework that wraps arbitrary objects that have had some annotation added to the class. These annotations will be read to do the validation and form generation. In a way this tutorial is showing how to create a simple framework for form generation. - -The example code used here is available in its finished form in `form-generation-example/ <form-generation-example/>`_. - |
|
From: <sub...@co...> - 2008-03-27 15:20:55
|
Author: ianb
Date: 2008-03-27 09:20:54 -0600 (Thu, 27 Mar 2008)
New Revision: 3361
Added:
FormEncode/trunk/docs/form-generation-example/
FormEncode/trunk/docs/form-generation-example/crud_index.html.tmpl
FormEncode/trunk/docs/form-generation-example/generatorapp.py
FormEncode/trunk/docs/form-generation-example/generatoreditable.py
FormEncode/trunk/docs/form-generation-example/index.html.tmpl
FormEncode/trunk/docs/form-generation-example/server.py
FormEncode/trunk/docs/form-generation.txt
Modified:
FormEncode/trunk/docs/news.txt
FormEncode/trunk/tests/test_htmlfill.py
Log:
update news for new release
Added: FormEncode/trunk/docs/form-generation-example/crud_index.html.tmpl
===================================================================
--- FormEncode/trunk/docs/form-generation-example/crud_index.html.tmpl (rev 0)
+++ FormEncode/trunk/docs/form-generation-example/crud_index.html.tmpl 2008-03-27 15:20:54 UTC (rev 3361)
@@ -0,0 +1,35 @@
+{{py:cls_title = crudapp.object_class_title(object_class)}}
+<html>
+ <head>
+ <title>Index of {{cls_title}}</title>
+ </head>
+ <body>
+ <h1>Index of {{cls_title}}</h1>
+
+ <div>
+ Description: {{crudapp.object_class_description(object_class)}}
+ </div>
+
+ <div>
+ <a href="{{req.application_url}}/__create__">Create {{cls_title}}</a>
+ </div>
+
+ Existing objects:
+
+ <ul>
+ {{for name, object in objects:}}
+ {{py:desc = crudapp.object_description(object)}}
+ <li>{{crudapp.object_title(object)}} (<a href="{{req.application_url}}/{{name|url}}">Edit {{name}}</a>)
+ {{if desc}}
+ <br> {{desc}}
+ {{endif}}
+ </li>
+ {{endfor}}
+ </ul>
+
+ {{if not objects:}}
+ <p>No objects exist!</p>
+ {{endif}}
+
+ </body>
+</html>
Added: FormEncode/trunk/docs/form-generation-example/generatorapp.py
===================================================================
--- FormEncode/trunk/docs/form-generation-example/generatorapp.py (rev 0)
+++ FormEncode/trunk/docs/form-generation-example/generatorapp.py 2008-03-27 15:20:54 UTC (rev 3361)
@@ -0,0 +1,111 @@
+from webob import Request, Response
+from webob import exc
+from tempita import HTMLTemplate, html
+import os
+import generatoreditable
+import textwrap
+
+template_dir = os.path.dirname(__file__)
+# Dict of template_name: (template_mtime, template_object)
+_templates = {}
+
+def get_template(template_name):
+ filename = os.path.join(template_dir, template_name)
+ mtime = os.stat(filename).st_mtime
+ if (template_name not in _templates
+ or _templates[template_name][0] < mtime):
+ _templates[template_name] = (mtime, HTMLTemplate.from_filename(filename))
+ return _templates[template_name][1]
+
+
+
+class CrudApp(object):
+
+ def __init__(self):
+ self.objects = {}
+ self.object_classes = dict(
+ State: generatoreditable.State,
+ )
+
+ def __call__(self, environ, start_response):
+ req = Request(environ)
+ name = req.path_info_peek()
+ req.urlvars['generatorapp.root'] = req.application_uri
+ if not name:
+ # Index page:
+ resp = self.index(req)
+ elif name not in self.object_classes:
+ resp = exc.HTTPNotFound(
+ "No class is registered with the name %r" % name)
+ else:
+ resp = self.crud(req, self.object_classes[name])
+ return resp(environ, start_response)
+
+ def index(self, req):
+ tmpl = get_template('index.html.tmpl')
+ return Response(
+ tmpl.substitute(req=req,
+ crudapp=self,
+ object_classes=self.object_classes))
+
+ def crud(self, req, object_class):
+ obj_class = req.urlvars['generatorapp.class']
+ name = req.path_info_peek()
+ if not name:
+ return self.crud_index(req, object_class)
+ elif name == '__create__':
+ return self.crud_edit(req, object_class, None)
+ else:
+ try:
+ obj = obj_class.get_from_url(name, req, self)
+ except exc.HTTPException, e:
+ return e
+ return self.crut_edit(req, object_class, obj)
+
+ def crud_index(self, req, object_class):
+ tmpl = get_template('crud_index.html.tmpl')
+ objects = object_class.get_all(req, crudapp)
+ if isinstance(objects, dict):
+ objects = sorted(objects.iteritems())
+ if not isinstance(objects, list):
+ objects = list(objects)
+ return Response(
+ tmpl.substitute(req=req,
+ crudapp=self,
+ objects=objects,
+ object_class=object_class))
+
+ ## Adapters for use with templates:
+
+ def render_template(self_, obj, attr, default, **kw):
+ tmpl = getattr(obj, attr, None)
+ if not tmpl:
+ return default
+ if isinstance(obj, type):
+ obj_class = obj
+ else:
+ obj_class = obj.__class__
+ if isinstance(tmpl, basestring):
+ tmpl = textwrap.dedent(tmpl).strip()
+ tmpl = HTMLTemplate(tmpl, name="%s.%s.%s" %
+ (obj_class.__module__, object_class.__name__, attr))
+ return tmpl.substitute(crudapp=self_, **kw)|html
+
+ def object_class_title(self, req, cls):
+ return self.render_template(
+ cls, 'class_title', cls.__name__, req=req, class_=cls)
+
+ def object_class_description(self, req, cls):
+ return self.render_template(
+ cls, 'class_description', cls.__doc__, req=req, class_=cls)
+
+ def object_title(self, req, obj):
+ return self.render_template(
+ obj, 'title', repr(obj), req=req, self=obj)
+
+ def object_description(self, req, obj):
+ return self.render_template(
+ obj, 'description', None, req=req, self=obj)
+
+
+
Property changes on: FormEncode/trunk/docs/form-generation-example/generatorapp.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: FormEncode/trunk/docs/form-generation-example/generatoreditable.py
===================================================================
--- FormEncode/trunk/docs/form-generation-example/generatoreditable.py (rev 0)
+++ FormEncode/trunk/docs/form-generation-example/generatoreditable.py 2008-03-27 15:20:54 UTC (rev 3361)
@@ -0,0 +1,166 @@
+from formencode.schema import Schema
+from formencode import validators
+
+class AbstractEditable(object):
+ """
+ This represents a basic editable object. It's more of a
+ self-documenting example; you should not subclass this object.
+ """
+
+ class_title = '''
+ Title that can use class_ and req variables. Defaults to __name__ if not set
+ '''
+
+ class_description = '''
+ Longer description that can use class_ and req variables. Default to __doc__ if not set.
+ '''
+
+ title = '''
+ Title for an instance that can use self and req variables. Defaults to repr() if not set.
+ '''
+
+ description = '''
+ Description for an instance that can use self and req variables. Defaults to empty if not set.
+ '''
+
+ @classmethod
+ def get_from_url(cls, urlsegment, req, crudapp):
+ """
+ Gets one object from a url segment. You should only use the
+ req object for access control. You may raise a
+ webob.exc.HTTPException exception.
+ """
+ raise NotImplementedError
+
+ @classmethod
+ def get_all(cls, req, crudapp):
+ """
+ Returns all the objects for this class, as a dictionary of
+ {urlsegment: object} or a list of [(urlsegment, object)] (or
+ an iterator of those tuples).
+ """
+ raise NotImplementedError
+
+ @classmethod
+ def default_attrs(cls, req, crudapp):
+ """
+ Returns a dictionary of the default attrs for a new object
+ """
+ raise NotImplementedError
+
+ @classmethod
+ def create_object(cls, req, crudapp, **attrs):
+ """
+ Creates a new object using the given attrs, and returns that object.
+ """
+ raise NotImplementedError
+
+ def object_attrs(self, req, crudapp):
+ """
+ Returns the object attrs for this object.
+ """
+ raise NotImplementedError
+
+ urlsegment = property(doc="Gives the instance's urlsegment for fetching")
+
+ def update_object(self, req, crudapp, **attrs):
+ """
+ Updates an existing instance using the given attrs.
+ """
+ raise NotImplementedError
+
+ # Used to provide an ordering for fields; if this exists then any
+ # fields not listed will end up last. Other fields will be
+ # ordered according to this:
+ field_order = ['field1', 'field2']
+
+ # A schema to validate and convert the attrs:
+ schema = Schema()
+
+ @classmethod
+ def validate_fields(cls, attrs, req, crudapp, state, self):
+ """
+ This is a simpler setup for validating the attrs; it may
+ update the attrs in-place.
+
+ state is the formencode state object
+
+ self will be None if this is a create
+ """
+ pass
+
+ @classmethod
+ def fields(cls, req, crudapp, self=None):
+ """
+ A classmethod (if called on an instance, then self is also
+ passed in). This returns a list of fields to use to edit the
+ form.
+ """
+
+
+class State(object):
+
+ _states = {}
+
+ class_title = 'States'
+ class_description = '''
+ All the states. Contains the full state name and the state postal code.
+ '''
+ title = '''The state {{self.name}} (code {{self.code}})'''
+
+ def __init__(self, name, code):
+ self.name = name
+ self.code = code
+ self._states[code] = self
+
+ @classmethod
+ def get_from_url(cls, urlsegment, req, crudapp):
+ ## FIXME: not found?
+ return cls._states[urlsegment]
+
+ @classmethod
+ def get_all(cls, req, crudapp):
+ return cls._states
+
+ @classmethod
+ def create_object(cls, req, crudapp, name, code):
+ return cls(name, code)
+
+ def object_attrs(self, req, crudapp):
+ return dict(name=self.name, code=self.code)
+
+ @property
+ def urlsegment(self):
+ return self.code
+
+ def update_object(self, req, crudapp, name, code):
+ self.name = name
+ self.code = code
+
+ field_order = ['name', 'code']
+
+ def validate_fields(self, attrs, req, crudapp, state):
+ code = attrs['code']
+ if self is None:
+ if code in self._states:
+ return {'code': 'A state with the code %s already exists' % code}
+ attrs['code'] = attrs['code'].upper()
+
+ class schema(Schema):
+ name = validators.String(not_empty=True)
+ code = validators.String(min=2, max=2)
+
+class Address(object):
+
+ _addresses = []
+
+ def __init__(self, name, street, city, state, postal):
+ self.name = name
+ self.street = street
+ self.city = city
+ self.state = state
+ self.postal = postal
+ self._addresses.append(self)
+
+
+
Property changes on: FormEncode/trunk/docs/form-generation-example/generatoreditable.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: FormEncode/trunk/docs/form-generation-example/index.html.tmpl
===================================================================
--- FormEncode/trunk/docs/form-generation-example/index.html.tmpl (rev 0)
+++ FormEncode/trunk/docs/form-generation-example/index.html.tmpl 2008-03-27 15:20:54 UTC (rev 3361)
@@ -0,0 +1,21 @@
+<html>
+ <head>
+ <title>Index of Object Types</title>
+ </head>
+ <body>
+ <h1>Index of Object Types</h1>
+
+ <ul>
+ {{for class_name in object_classes:}}
+ <li><a href="{{req.application_url}}/{{class_name|url}}">{{class_name}}</a></li>
+ {{endfor}}
+ </ul>
+
+ {{if not object_classes:}}
+ No classes are defined!
+ {{endif}}
+
+ </body>
+</html>
+
+
Added: FormEncode/trunk/docs/form-generation-example/server.py
===================================================================
--- FormEncode/trunk/docs/form-generation-example/server.py (rev 0)
+++ FormEncode/trunk/docs/form-generation-example/server.py 2008-03-27 15:20:54 UTC (rev 3361)
@@ -0,0 +1,26 @@
+import sys, os
+
+# This sets up the path so we can import the other modules:
+sys.path.insert(0, os.path.dirname(__file__))
+
+from generatorapp import CrudApp
+
+if __name__ == '__main__':
+ import optparse
+ parser = optparse.OptionParser(
+ usage='%prog --port=PORT BASE_DIRECTORY'
+ )
+ parser.add_option(
+ '-p', '--port',
+ default='8080',
+ dest='port',
+ type='int',
+ help='Port to serve on (default 8080)')
+ app = CrudApplication()
+ from wsgiref.simple_server import make_server
+ httpd = make_server('localhost', options.port, app)
+ print 'Serving on http://localhost:%s' % options.port
+ try:
+ httpd.serve_forever()
+ except KeyboardInterrupt:
+ print '^C'
Property changes on: FormEncode/trunk/docs/form-generation-example/server.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: FormEncode/trunk/docs/form-generation.txt
===================================================================
--- FormEncode/trunk/docs/form-generation.txt (rev 0)
+++ FormEncode/trunk/docs/form-generation.txt 2008-03-27 15:20:54 UTC (rev 3361)
@@ -0,0 +1,16 @@
+Form Generation with FormEncode and htmlfill
+++++++++++++++++++++++++++++++++++++++++++++
+
+.. contents::
+
+Introduction
+============
+
+This is a tutorial to teach you how to do form generation using FormEncode for `validation <Validation.html>`_, and `htmlfill <htmlfill.html>`_ for filling the forms, together with your own ad hoc code to generate the HTML.
+
+This tutorial does not use a framework, as several frameworks that use FormEncode have their own wrappers for invoking validation. These wrappers are typically closely bound to the framework and cover up some of the steps. While this is fine and those wrappers are useful, they could be distracting in this example. A very simple framework using `WebOb <http://pythonpaste.org/webob/>`_ is used in these examples. For templating `Tempita <http://pythonpaste.org/tempita/>`_ will be used.
+
+The example itself is a simple CRUD framework that wraps arbitrary objects that have had some annotation added to the class. These annotations will be read to do the validation and form generation. In a way this tutorial is showing how to create a simple framework for form generation.
+
+The example code used here is available in its finished form in `form-generation-example/ <form-generation-example/>`_.
+
Property changes on: FormEncode/trunk/docs/form-generation.txt
___________________________________________________________________
Name: svn:keywords
+ LastChangedDate LastChangedRevision
Name: svn:eol-style
+ native
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2008-03-26 17:17:48 UTC (rev 3360)
+++ FormEncode/trunk/docs/news.txt 2008-03-27 15:20:54 UTC (rev 3361)
@@ -3,8 +3,8 @@
.. contents::
-svn trunk
----------
+1.0.1
+-----
* ``chained_validators`` were removed from Schema somehow; now
replaced and working.
Modified: FormEncode/trunk/tests/test_htmlfill.py
===================================================================
--- FormEncode/trunk/tests/test_htmlfill.py 2008-03-26 17:17:48 UTC (rev 3360)
+++ FormEncode/trunk/tests/test_htmlfill.py 2008-03-27 15:20:54 UTC (rev 3361)
@@ -88,3 +88,8 @@
{}, {}) ==
u'<input type="submit" value="Japan - 日本 Nihon" />')
+def test_xhtml():
+ result = htmlfill.render('<form:error name="code"/>', errors={'code': 'an error'})
+ print result
+ assert 0
+
|
|
From: <sub...@co...> - 2008-03-26 17:17:46
|
Author: ianb
Date: 2008-03-26 11:17:48 -0600 (Wed, 26 Mar 2008)
New Revision: 3360
Modified:
FormEncode/trunk/docs/Validator.txt
FormEncode/trunk/formencode/validators.py
Log:
fix some doctests in small ways
Modified: FormEncode/trunk/docs/Validator.txt
===================================================================
--- FormEncode/trunk/docs/Validator.txt 2008-03-26 03:23:15 UTC (rev 3359)
+++ FormEncode/trunk/docs/Validator.txt 2008-03-26 17:17:48 UTC (rev 3360)
@@ -222,10 +222,11 @@
so, for example, if you have an email_confirm and a password_confirm
fields and use FieldsMatch on both of them as follows:
- >>> chained_validators [ validators.FieldsMatch('password',
- ... 'password_confirm'),
- ... validators.FieldsMatch('email',
- ... 'email_confirm') ]
+ >>> chained_validators = [
+ ... validators.FieldsMatch('password',
+ ... 'password_confirm'),
+ ... validators.FieldsMatch('email',
+ ... 'email_confirm')]
This will leave the error_dict with both password_confirm and
email_confirm error keys, which is likely the desired behavior
@@ -248,7 +249,11 @@
... return {'state': 'You must enter a state'}
>>> ValidateState = SimpleFormValidator(validate_state)
>>> ValidateState.to_python({'country': 'US'}, None)
+ Traceback (most recent call last):
+ ...
+ Invalid: state: You must enter a state
+
The ``validate_state`` function (or any validation function) returns
any errors in the form (or it may raise Invalid directly). It can
also modify the ``value_dict`` dictionary directly. When it returns
Modified: FormEncode/trunk/formencode/validators.py
===================================================================
--- FormEncode/trunk/formencode/validators.py 2008-03-26 03:23:15 UTC (rev 3359)
+++ FormEncode/trunk/formencode/validators.py 2008-03-26 17:17:48 UTC (rev 3360)
@@ -1241,6 +1241,7 @@
'doe...@co...'
>>> e.to_python('te...@fo...')
'te...@fo...'
+ >>> # NOTE: If you do not have PyDNS installed this example won't work:
>>> e.to_python('te...@th...')
Traceback (most recent call last):
...
|
|
From: <sub...@co...> - 2008-03-26 03:23:11
|
Author: ianb
Date: 2008-03-25 21:23:15 -0600 (Tue, 25 Mar 2008)
New Revision: 3359
Modified:
FormEncode/trunk/formencode/validators.py
Log:
Fixed docstring (testValueLists->testValueList), #1822417
Modified: FormEncode/trunk/formencode/validators.py
===================================================================
--- FormEncode/trunk/formencode/validators.py 2008-03-26 03:21:57 UTC (rev 3358)
+++ FormEncode/trunk/formencode/validators.py 2008-03-26 03:23:15 UTC (rev 3359)
@@ -574,7 +574,7 @@
"""
Tests that the value is one of the members of a given list.
- If ``testValueLists=True``, then if the input value is a list or
+ If ``testValueList=True``, then if the input value is a list or
tuple, all the members of the sequence will be checked (i.e., the
input must be a subset of the allowed values).
|
|
From: <sub...@co...> - 2008-03-26 03:21:56
|
Author: ianb
Date: 2008-03-25 21:21:57 -0600 (Tue, 25 Mar 2008)
New Revision: 3358
Modified:
FormEncode/trunk/docs/news.txt
FormEncode/trunk/formencode/htmlfill.py
Log:
Pass through error_class option (#1922986)
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2008-03-26 03:17:04 UTC (rev 3357)
+++ FormEncode/trunk/docs/news.txt 2008-03-26 03:21:57 UTC (rev 3358)
@@ -9,6 +9,10 @@
* ``chained_validators`` were removed from Schema somehow; now
replaced and working.
+* Put in missing ``htmlfill.render(error_class=...)`` parameter (was
+ documented and implemented, but ``render()`` did not pass it
+ through).
+
1.0
---
Modified: FormEncode/trunk/formencode/htmlfill.py
===================================================================
--- FormEncode/trunk/formencode/htmlfill.py 2008-03-26 03:17:04 UTC (rev 3357)
+++ FormEncode/trunk/formencode/htmlfill.py 2008-03-26 03:21:57 UTC (rev 3358)
@@ -15,7 +15,8 @@
def render(form, defaults=None, errors=None, use_all_keys=False,
error_formatters=None, add_attributes=None,
auto_insert_errors=True, auto_error_formatter=None,
- text_as_default=False, listener=None, encoding=None):
+ text_as_default=False, listener=None, encoding=None,
+ error_class='error'):
"""
Render the ``form`` (which should be a string) given the defaults
and errors. Defaults are the values that go in the input fields
@@ -69,6 +70,7 @@
auto_error_formatter=auto_error_formatter,
text_as_default=text_as_default,
listener=listener, encoding=encoding,
+ error_class=error_class,
)
p.feed(form)
p.close()
|
|
From: <sub...@co...> - 2008-03-26 03:17:04
|
Author: ianb
Date: 2008-03-25 21:17:04 -0600 (Tue, 25 Mar 2008)
New Revision: 3357
Modified:
FormEncode/trunk/docs/news.txt
FormEncode/trunk/formencode/schema.py
Log:
fix chained validators (#1925164), from Petter Urkedal
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2008-03-19 21:58:11 UTC (rev 3356)
+++ FormEncode/trunk/docs/news.txt 2008-03-26 03:17:04 UTC (rev 3357)
@@ -3,6 +3,12 @@
.. contents::
+svn trunk
+---------
+
+* ``chained_validators`` were removed from Schema somehow; now
+ replaced and working.
+
1.0
---
Modified: FormEncode/trunk/formencode/schema.py
===================================================================
--- FormEncode/trunk/formencode/schema.py 2008-03-19 21:58:11 UTC (rev 3356)
+++ FormEncode/trunk/formencode/schema.py 2008-03-26 03:17:04 UTC (rev 3357)
@@ -196,6 +196,9 @@
value_dict, state,
error_dict=errors)
+ for validator in self.chained_validators:
+ new = validator.to_python(new, state)
+
return new
finally:
|
|
From: <sub...@co...> - 2008-03-19 21:58:10
|
Author: ianb Date: 2008-03-19 15:58:11 -0600 (Wed, 19 Mar 2008) New Revision: 3356 Modified: FormEncode/trunk/formencode/i18n/msgfmt.py FormEncode/trunk/setup.cfg Log: Change shebang in i18n script to not be version-specific; don't use [easy_install] section that points to non-existant link. Modified: FormEncode/trunk/formencode/i18n/msgfmt.py =================================================================== --- FormEncode/trunk/formencode/i18n/msgfmt.py 2008-03-18 18:41:53 UTC (rev 3355) +++ FormEncode/trunk/formencode/i18n/msgfmt.py 2008-03-19 21:58:11 UTC (rev 3356) @@ -1,4 +1,4 @@ -#! /usr/bin/python2.4 +#! /usr/bin/python # -*- coding: iso-8859-1 -*- # Written by Martin v. L <lo...@in...> Modified: FormEncode/trunk/setup.cfg =================================================================== --- FormEncode/trunk/setup.cfg 2008-03-18 18:41:53 UTC (rev 3355) +++ FormEncode/trunk/setup.cfg 2008-03-19 21:58:11 UTC (rev 3356) @@ -1,6 +1,3 @@ -[easy_install] -find_links = http://svn.pythonpaste.org/package_index.html - [global] command_packages = buildutils.pudge_command, buildutils.publish_command |
|
From: <sub...@co...> - 2008-03-14 18:18:34
|
Author: ianb
Date: 2008-03-14 12:18:36 -0600 (Fri, 14 Mar 2008)
New Revision: 3337
Modified:
FormEncode/trunk/docs/news.txt
FormEncode/trunk/formencode/api.py
Log:
Add messages, all_messages, subvalidators to __singletonmethods__
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2008-03-12 22:22:34 UTC (rev 3336)
+++ FormEncode/trunk/docs/news.txt 2008-03-14 18:18:36 UTC (rev 3337)
@@ -13,6 +13,9 @@
chained validators get run even when there are previous errors (to
detect all the errors).
+* While something like ``Int.to_python()`` worked, other methods like
+ ``Int.message(...)`` didn't work. Now it does.
+
0.9
---
Modified: FormEncode/trunk/formencode/api.py
===================================================================
--- FormEncode/trunk/formencode/api.py 2008-03-12 22:22:34 UTC (rev 3336)
+++ FormEncode/trunk/formencode/api.py 2008-03-14 18:18:36 UTC (rev 3337)
@@ -157,7 +157,8 @@
use_builtins_gettext = True #In case you dont want to use __builtins__._
#altough it may be definied, set this to False
- __singletonmethods__ = ('to_python', 'from_python')
+ __singletonmethods__ = ('to_python', 'from_python', 'message', 'all_messages',
+ 'subvalidators')
def __classinit__(cls, new_attrs):
if new_attrs.has_key('messages'):
|
|
From: <sub...@co...> - 2008-03-05 01:39:10
|
Author: pjenvey
Date: 2008-03-04 18:39:13 -0700 (Tue, 04 Mar 2008)
New Revision: 3297
Added:
FormEncode/trunk/tests/__init__.py
Removed:
FormEncode/trunk/tests/conftest.py
Modified:
FormEncode/trunk/setup.cfg
FormEncode/trunk/setup.py
FormEncode/trunk/tests/test_context.py
FormEncode/trunk/tests/test_schema.py
Log:
o use nose as the preferred test runner, with setup.py test support
o only require elementtree if < 2.5
Modified: FormEncode/trunk/setup.cfg
===================================================================
--- FormEncode/trunk/setup.cfg 2008-03-05 01:37:52 UTC (rev 3296)
+++ FormEncode/trunk/setup.cfg 2008-03-05 01:39:13 UTC (rev 3297)
@@ -41,3 +41,6 @@
[aliases]
distribute = register sdist bdist_egg upload pudge publish
+
+[nosetests]
+detailed-errors = 1
Modified: FormEncode/trunk/setup.py
===================================================================
--- FormEncode/trunk/setup.py 2008-03-05 01:37:52 UTC (rev 3296)
+++ FormEncode/trunk/setup.py 2008-03-05 01:39:13 UTC (rev 3297)
@@ -1,3 +1,4 @@
+import sys
try:
from setuptools import setup
except ImportError:
@@ -7,6 +8,10 @@
version = '0.9.1'
+tests_require = ['nose']
+if sys.version < '2.5':
+ tests_require.append('elementtree')
+
setup(name="FormEncode",
version=version,
description="HTML form validation, generation, and conversion package",
@@ -31,7 +36,8 @@
license="PSF",
packages=["formencode", "formencode.util"],
include_package_data=True,
- extras_require={'testing': ['elementtree']},
+ test_suite='nose.collector',
+ tests_require=tests_require
)
# Send announce to:
Copied: FormEncode/trunk/tests/__init__.py (from rev 3295, FormEncode/trunk/tests/conftest.py)
===================================================================
--- FormEncode/trunk/tests/__init__.py (rev 0)
+++ FormEncode/trunk/tests/__init__.py 2008-03-05 01:39:13 UTC (rev 3297)
@@ -0,0 +1,4 @@
+import sys, os
+sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
+import pkg_resources
+pkg_resources.require('FormEncode')
Deleted: FormEncode/trunk/tests/conftest.py
===================================================================
--- FormEncode/trunk/tests/conftest.py 2008-03-05 01:37:52 UTC (rev 3296)
+++ FormEncode/trunk/tests/conftest.py 2008-03-05 01:39:13 UTC (rev 3297)
@@ -1,7 +0,0 @@
-import sys, os
-sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
-import pkg_resources
-try:
- import elementtree
-except ImportError:
- pkg_resources.require('FormEncode[testing]')
Modified: FormEncode/trunk/tests/test_context.py
===================================================================
--- FormEncode/trunk/tests/test_context.py 2008-03-05 01:37:52 UTC (rev 3296)
+++ FormEncode/trunk/tests/test_context.py 2008-03-05 01:39:13 UTC (rev 3297)
@@ -1,5 +1,5 @@
from formencode.context import Context, ContextRestoreError
-from py.test import raises
+from nose.tools import assert_raises
c1 = Context(default=None)
c2 = Context()
@@ -29,7 +29,7 @@
c3 = Context()
res1 = c3.set(a=1)
res2 = c3.set(b=2)
- raises(ContextRestoreError, 'res1.restore()')
+ assert_raises(ContextRestoreError, res1.restore)
assert c3.b==2
assert c3.a==1
res2.restore()
Modified: FormEncode/trunk/tests/test_schema.py
===================================================================
--- FormEncode/trunk/tests/test_schema.py 2008-03-05 01:37:52 UTC (rev 3296)
+++ FormEncode/trunk/tests/test_schema.py 2008-03-05 01:39:13 UTC (rev 3297)
@@ -134,7 +134,7 @@
def test_this():
for case in all_cases:
- yield case.test
+ yield (case.test,)
def test_merge():
|
|
From: <sub...@co...> - 2008-03-05 01:37:51
|
Author: pjenvey
Date: 2008-03-04 18:37:52 -0700 (Tue, 04 Mar 2008)
New Revision: 3296
Modified:
FormEncode/trunk/formencode/doctest_xml_compare.py
FormEncode/trunk/formencode/htmlgen.py
FormEncode/trunk/tests/test_doctest_xml_compare.py
FormEncode/trunk/tests/test_htmlfill.py
Log:
use builtin elementtree if available
Modified: FormEncode/trunk/formencode/doctest_xml_compare.py
===================================================================
--- FormEncode/trunk/formencode/doctest_xml_compare.py 2008-03-04 19:01:46 UTC (rev 3295)
+++ FormEncode/trunk/formencode/doctest_xml_compare.py 2008-03-05 01:37:52 UTC (rev 3296)
@@ -3,7 +3,10 @@
doctest.OutputChecker
except AttributeError:
import util.doctest24 as doctest
-import elementtree.ElementTree as et
+try:
+ import xml.etree.ElementTree as ET
+except ImportError:
+ import elementtree.ElementTree as ET
from xml.parsers.expat import ExpatError as XMLParseError
RealOutputChecker = doctest.OutputChecker
@@ -111,12 +114,12 @@
return (t1 or '').strip() == (t2 or '').strip()
def make_xml(s):
- return et.XML('<xml>%s</xml>' % s)
+ return ET.XML('<xml>%s</xml>' % s)
def make_string(xml):
if isinstance(xml, (str, unicode)):
xml = make_xml(xml)
- s = et.tostring(xml)
+ s = ET.tostring(xml)
if s == '<xml />':
return ''
assert s.startswith('<xml>') and s.endswith('</xml>'), repr(s)
Modified: FormEncode/trunk/formencode/htmlgen.py
===================================================================
--- FormEncode/trunk/formencode/htmlgen.py 2008-03-04 19:01:46 UTC (rev 3295)
+++ FormEncode/trunk/formencode/htmlgen.py 2008-03-05 01:37:52 UTC (rev 3296)
@@ -59,7 +59,10 @@
from __future__ import generators
from cgi import escape
-import elementtree.ElementTree as et
+try:
+ import xml.etree.ElementTree as ET
+except ImportError:
+ import elementtree.ElementTree as ET
default_encoding = 'utf-8'
@@ -74,7 +77,7 @@
if attr.find('__') != -1:
attr = attr.replace('__', ':')
if attr == 'comment':
- return Element(et.Comment, {})
+ return Element(ET.Comment, {})
else:
return Element(attr, {})
@@ -102,7 +105,7 @@
html = _HTML()
-class Element(et._ElementInterface):
+class Element(ET._ElementInterface):
def __call__(self, *args, **kw):
el = self.__class__(self.tag, self.attrib)
@@ -136,7 +139,7 @@
for arg in flatten(args):
if arg is None:
continue
- if not et.iselement(arg):
+ if not ET.iselement(arg):
if last is None:
if el.text is None:
el.text = unicode(arg)
@@ -153,7 +156,7 @@
return el
def __str__(self):
- return et.tostring(self, default_encoding)
+ return ET.tostring(self, default_encoding)
def __unicode__(self):
# This is lame!
Modified: FormEncode/trunk/tests/test_doctest_xml_compare.py
===================================================================
--- FormEncode/trunk/tests/test_doctest_xml_compare.py 2008-03-04 19:01:46 UTC (rev 3295)
+++ FormEncode/trunk/tests/test_doctest_xml_compare.py 2008-03-05 01:37:52 UTC (rev 3296)
@@ -2,8 +2,8 @@
from formencode.htmlgen import html
import sys
-XML = dxml.et.XML
-tostring = dxml.et.tostring
+XML = dxml.ET.XML
+tostring = dxml.ET.tostring
def test_xml_compare():
t1 = XML('<test />')
Modified: FormEncode/trunk/tests/test_htmlfill.py
===================================================================
--- FormEncode/trunk/tests/test_htmlfill.py 2008-03-04 19:01:46 UTC (rev 3295)
+++ FormEncode/trunk/tests/test_htmlfill.py 2008-03-05 01:37:52 UTC (rev 3296)
@@ -10,9 +10,12 @@
sys.path.insert(0, base_dir)
from formencode import htmlfill
from formencode.doctest_xml_compare import xml_compare
-from elementtree import ElementTree as et
from xml.parsers.expat import ExpatError
from formencode import htmlfill_schemabuilder
+try:
+ import xml.etree.ElementTree as ET
+except ImportError:
+ import elementtree.ElementTree as ET
def test_inputoutput():
data_dir = os.path.join(os.path.dirname(__file__), 'htmlfill_data')
@@ -57,8 +60,8 @@
def reporter(v):
print v
try:
- output_xml = et.XML(output)
- expected_xml = et.XML(expected)
+ output_xml = ET.XML(output)
+ expected_xml = ET.XML(expected)
except ExpatError:
comp = output.strip() == expected.strip()
else:
|
Author: gh
Date: 2008-02-16 23:37:35 -0700 (Sat, 16 Feb 2008)
New Revision: 3259
Added:
FormEncode/trunk/formencode/i18n/fi/
FormEncode/trunk/formencode/i18n/fi/LC_MESSAGES/
FormEncode/trunk/formencode/i18n/fi/LC_MESSAGES/FormEncode.mo
FormEncode/trunk/formencode/i18n/fi/LC_MESSAGES/FormEncode.po
FormEncode/trunk/formencode/i18n/it/
FormEncode/trunk/formencode/i18n/it/LC_MESSAGES/
FormEncode/trunk/formencode/i18n/it/LC_MESSAGES/FormEncode.mo
FormEncode/trunk/formencode/i18n/it/LC_MESSAGES/FormEncode.po
FormEncode/trunk/formencode/i18n/nb_NO/
FormEncode/trunk/formencode/i18n/nb_NO/LC_MESSAGES/
FormEncode/trunk/formencode/i18n/nb_NO/LC_MESSAGES/FormEncode.mo
FormEncode/trunk/formencode/i18n/nb_NO/LC_MESSAGES/FormEncode.po
Modified:
FormEncode/trunk/tests/test_i18n.py
Log:
Added Italian (it), Finnish (fi) and Norwegian (nb_NO) translation
Added: FormEncode/trunk/formencode/i18n/fi/LC_MESSAGES/FormEncode.mo
===================================================================
(Binary files differ)
Property changes on: FormEncode/trunk/formencode/i18n/fi/LC_MESSAGES/FormEncode.mo
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: FormEncode/trunk/formencode/i18n/fi/LC_MESSAGES/FormEncode.po
===================================================================
--- FormEncode/trunk/formencode/i18n/fi/LC_MESSAGES/FormEncode.po (rev 0)
+++ FormEncode/trunk/formencode/i18n/fi/LC_MESSAGES/FormEncode.po 2008-02-17 06:37:35 UTC (rev 3259)
@@ -0,0 +1,325 @@
+# Finnish strings for FormEncode
+# Copyright (C) 2007 Multimediastudio, licence: LGPL V2.0
+# Marko Manninen <mm...@gm...>, 2007
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: FormEncode 0.7.1\n"
+"POT-Creation-Date: 2006-10-02 20:59+CEST\n"
+"PO-Revision-Date: 2007-11-07 10:45+ZONE\n"
+"Last-Translator: Marko Manninen <mm...@gm...>\n"
+"Language-Team: FINNISH <FI...@li...>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: pygettext.py 1.5\n"
+
+
+#: api.py:335 validators.py:433
+msgid "Please enter a value"
+msgstr "Anna arvo"
+
+#: api.py:336
+msgid "The input must be a string (not a %(type)s: %(value)r)"
+msgstr "Syötteen täytyy olla merkkijono (ei %(type)s: %(value)r)"
+
+#: api.py:337
+msgid "The input must be a string (not None)"
+msgstr "Syötteen täytyy olla merkkijono (ei None)"
+
+#: validators.py:160
+msgid "%(object)r is not a subclass of %(subclass)s"
+msgstr "%(object)r ei ole %(subclass)s :n aliluokka"
+
+#: validators.py:161
+msgid "%(object)r is not a subclass of one of the types %(subclassList)s"
+msgstr "%(object)r ei ole listan %(subclassList)s aliluokkatyyppi"
+
+#: validators.py:162
+msgid "%(object)r must be one of the types %(typeList)s"
+msgstr "%(object)r täytyy olla joku tyypeistä: %(typeList)s"
+
+#: validators.py:163
+msgid "%(object)r must be of the type %(type)s"
+msgstr "%(object)r täytyy olla tyyppiä: %(type)s"
+
+#: validators.py:344
+msgid "Enter a value less than %(maxLength)i characters long"
+msgstr "Anna pienempi kuin %(maxLength)i merkkiä pitkä arvo"
+
+#: validators.py:345 validators.py:399
+msgid "Invalid value (value with length expected)"
+msgstr "Väärä arvo (odotettiin pituusarvoa)"
+
+#: validators.py:398
+msgid "Enter a value at least %(minLength)i characters long"
+msgstr "Anna vähintään %(minLength)i merkkiä pitkä arvo"
+
+#: validators.py:458
+msgid "You cannot enter a value here"
+msgstr "Ei voida antaa arvoa tähän"
+
+#: validators.py:509
+msgid "The input is not valid"
+msgstr "Syöte ei kelpaa"
+
+#: validators.py:565
+msgid "Enter only letters, numbers, or _ (underscore)"
+msgstr "Vain kirjaimia, numeroita tai _ (alaviiva)"
+
+#: validators.py:604
+msgid "Invalid value"
+msgstr "Kelpaamaton arvo"
+
+#: validators.py:605
+msgid "Value must be one of: %(items)s (not %(value)r)"
+msgstr "Arvon täytyy olla jokin näistä: %(items)s (ei %(value)r)"
+
+#: validators.py:668
+msgid "Choose something"
+msgstr "Valitse jokin"
+
+#: validators.py:669
+msgid "Enter a value from: %(items)s"
+msgstr "Anna jokin arvoista: %(items)s"
+
+#: validators.py:670
+msgid "That value is not known"
+msgstr "Arvoa ei tunneta"
+
+#: validators.py:671
+msgid "Nothing in my dictionary goes by the value %(value)s. Choose one of: %(items)s"
+msgstr "Mikään kirjastosta ei käy arvoon: %(value)s. Valitse jokin näistä: %(items)s"
+
+#: validators.py:732
+msgid "Must be an integer index"
+msgstr "Indeksin täytyy olla kokonaisluku"
+
+#: validators.py:733
+msgid "Index out of range"
+msgstr "Indeksi yli rajan"
+
+#: validators.py:734
+msgid "Item %(value)s was not found in the list"
+msgstr "%(value)s ei löytynyt listasta"
+
+#: validators.py:809
+msgid "Date must be after %(date)s"
+msgstr "Päivämäärän täytyy olla %(date)s jälkeen"
+
+#: validators.py:810
+msgid "Date must be before %(date)s"
+msgstr "Päivämäärän täytyy olla ennen %(date)s"
+
+#: validators.py:812
+msgid "%%A, %%d %%B %%Y"
+msgstr ""
+
+#: validators.py:813
+msgid "The date must be sometime in the future"
+msgstr "Päivämäärä täytyy olla tulevaisuudessa"
+
+#: validators.py:913
+msgid "Please enter an integer value"
+msgstr "Anna kokonaisluku"
+
+#: validators.py:945
+msgid "Please enter a number"
+msgstr "Anna numero"
+
+#: validators.py:998
+msgid "Enter a value less than %(max)i characters long"
+msgstr "Anna maksimissaan %(max)i merkkiä pitkä arvo"
+
+#: validators.py:999
+msgid "Enter a value %(min)i characters long or more"
+msgstr "Anna vähintään %(min)i merkkiä pitkä arvo"
+
+#: validators.py:1050
+msgid "Invalid data or incorrect encoding"
+msgstr "Kelpaamaton data tai väärä merkistökoodaus"
+
+#: validators.py:1178
+msgid "Please enter an email address"
+msgstr "Anna e-mail osoite"
+
+#: validators.py:1179
+msgid "An email address must contain a single @"
+msgstr "Email osoitteen täytyy sisältää yksi @ -merkki"
+
+#: validators.py:1180
+msgid "The username portion of the email address is invalid (the portion before the @: %(username)s)"
+msgstr "Käyttäjätunnusosa sähköpostiosoitteesta on virheellinen (osa ennen @: %(username)s)"
+
+#: validators.py:1181 validators.py:1294
+msgid "An error occured when trying to connect to the server: %(error)s"
+msgstr "Tapahtui virhe yritettäessä yhdistää palvelimeen: %(error)s"
+
+#: validators.py:1182
+msgid "The domain portion of the email address is invalid (the portion after the @: %(domain)s)"
+msgstr "Domain osa sähköpostiosoitteesta on virheellinen (osa jälkeen @: %(domain)s)"
+
+#: validators.py:1183
+msgid "The domain of the email address does not exist (the portion after the @: %(domain)s)"
+msgstr "Sähköpostiosoitteessa olevaa domainia ei ole olemassa (osa jälkeen @: %(domain)s)"
+
+#: validators.py:1291
+msgid "You must start your URL with http://, https://, etc"
+msgstr "Aloita URL http://, https://, jne."
+
+#: validators.py:1292
+msgid "That is not a valid URL"
+msgstr "URL ei kelpaa"
+
+#: validators.py:1293
+msgid "An error occurred when trying to access the URL: %(error)s"
+msgstr "Tapahtui virhe URL osoitetta tavoitettaessa: %(error)s"
+
+#: validators.py:1295
+msgid "The server responded that the page could not be found"
+msgstr "Palvelin vastasi, että sivua ei löytynyt"
+
+#: validators.py:1296
+msgid "The server responded with a bad status code (%(status)s)"
+msgstr "Palvelin vastasi virhe -statuksella (%(status)s)"
+
+#: validators.py:1399
+msgid "Please enter a state code"
+msgstr "Anna osavaltiokoodi"
+
+#: validators.py:1400
+msgid "Please enter a state code with TWO letters"
+msgstr "Anna KAKSI kirjaiminen osavaltiokoodi"
+
+#: validators.py:1401
+msgid "That is not a valid state code"
+msgstr "Ei ole pätevä osavaltiokoodi"
+
+#: validators.py:1452
+msgid "Please enter a number, with area code, in the form ###-###-####, optionally with \"ext.####\""
+msgstr "Anna numero aluekoodilla muodossa ###-###-####, vaihtoehtoisesti \"ext.####\""
+
+#: validators.py:1614 validators.py:1622
+msgid "Please enter the date in the form %(format)s"
+msgstr "Anna päivämäärä muodossa: %(format)s"
+
+#: validators.py:1615
+msgid "Please enter a month from 1 to 12"
+msgstr "Anna kuukausi välillä 1-12"
+
+#: validators.py:1616
+msgid "Please enter a valid day"
+msgstr "Anna pätevä päivä"
+
+#: validators.py:1617
+msgid "That month only has %(days)i days"
+msgstr "Tässä kuukaudessa on %(days)i päivää"
+
+#: validators.py:1618
+msgid "That is not a valid day (%(exception)s)"
+msgstr "Ei ole pätevä päivä (%(exception)s)"
+
+#: validators.py:1619
+msgid "Unknown month name: %(month)s"
+msgstr "Tuntematon kuukauden nimi: %(month)s"
+
+#: validators.py:1620
+msgid "Please enter a number for the year"
+msgstr "Anna vuosiluku"
+
+#: validators.py:1621
+msgid "Please enter a four-digit year"
+msgstr "Anna nelinumeroinen vuosiluku"
+
+#: validators.py:1800
+msgid "You must indicate AM or PM"
+msgstr "Merkitse AM tai PM"
+
+#: validators.py:1801
+msgid "There are too many :'s"
+msgstr "Liian monta :'s"
+
+#: validators.py:1802
+msgid "You may not enter seconds"
+msgstr "Et voi antaa sekuntteja"
+
+#: validators.py:1803
+msgid "You must enter seconds"
+msgstr "Anna sekunnit"
+
+#: validators.py:1804
+msgid "You must enter minutes (after a :)"
+msgstr "Anna minuutit (jälkeen :)"
+
+#: validators.py:1805
+msgid "The %(part)s value you gave is not a number: %(number)r"
+msgstr "Annettu %(part)s arvo ei ole numero: %(number)r"
+
+#: validators.py:1806
+msgid "You must enter an hour in the range %(range)s"
+msgstr "Anna tunti välillä: %(range)s"
+
+#: validators.py:1807
+msgid "You must enter a minute in the range 0-59"
+msgstr "Anna minuutit välillä: 0-59"
+
+#: validators.py:1808
+msgid "You must enter a second in the range 0-59"
+msgstr "Anna sekunnit välillä 0-59"
+
+#: validators.py:1962
+msgid "Please enter a zip code (5 digits)"
+msgstr "Anna ZIP koodi (5 numeroa)"
+
+#: validators.py:1986
+msgid "The name %(name)s is missing"
+msgstr "Nimi %(name)s puuttuu"
+
+#: validators.py:2027
+msgid "Value should be %(true)r or %(false)r"
+msgstr "Arvon täytyy olla %(true)r tai %(false)r"
+
+#: validators.py:2062
+msgid "Value does not contain a signature"
+msgstr "Arvo ei sisällä allekirjoitusta"
+
+#: validators.py:2063
+msgid "Signature is not correct"
+msgstr "Allekirjoitus ei ole oikein"
+
+#: validators.py:2185
+msgid "Fields do not match (should be %(match)s)"
+msgstr "Kentät eivät täsmää (pitäisi olla %(match)s)"
+
+#: validators.py:2186
+msgid "Fields do not match"
+msgstr "Kentät eivät täsmää"
+
+#: validators.py:2248
+msgid "Please enter only the number, no other characters"
+msgstr "Anna vain numeroita, ei muita kirjaimia."
+
+#: validators.py:2249
+msgid "You did not enter a valid number of digits"
+msgstr "Et antanut pätevää numeroarvoa"
+
+#: validators.py:2250
+msgid "That number is not valid"
+msgstr "Numero ei ole pätevä"
+
+#: validators.py:2365
+msgid "Please enter numbers only for month and year"
+msgstr "Anna numerot vain kuukaudelle ja vuodelle"
+
+#: validators.py:2366
+msgid "Invalid Expiration Date"
+msgstr "Päättymispäivä ei ole pätevä"
+
+#: validators.py:2435
+msgid "Please enter numbers only for credit card security code"
+msgstr "Anna vain luottokortin varmistusnumero"
+
+#: validators.py:2436
+msgid "Invalid credit card security code length"
+msgstr "Kelpaamaton luottokortin varmistusnumeron pituus"
+
Added: FormEncode/trunk/formencode/i18n/it/LC_MESSAGES/FormEncode.mo
===================================================================
(Binary files differ)
Property changes on: FormEncode/trunk/formencode/i18n/it/LC_MESSAGES/FormEncode.mo
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: FormEncode/trunk/formencode/i18n/it/LC_MESSAGES/FormEncode.po
===================================================================
--- FormEncode/trunk/formencode/i18n/it/LC_MESSAGES/FormEncode.po (rev 0)
+++ FormEncode/trunk/formencode/i18n/it/LC_MESSAGES/FormEncode.po 2008-02-17 06:37:35 UTC (rev 3259)
@@ -0,0 +1,336 @@
+# Italian translation for FormEncode
+# Copyright (C) 2006 Jose Soares Da Silva, licensed under LGPL V2.0
+# <jos...@sf...>, 2007.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: FormEncode 0.51\n"
+"POT-Creation-Date: 2006-10-02 20:59+CEST\n"
+"PO-Revision-Date: 2006-10-03 08:59-0300\n"
+"Last-Translator: Jose Soares Da Silva <jos...@sf...>\n"
+"Language-Team: Jose Soares Da Silva <jos...@sf...>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: UTF-8\n"
+"Generated-By: pygettext.py 1.5\n"
+
+msgid "Please select at least a value"
+msgstr "Inserire almeno un dato"
+
+msgid "Invalid datetime format"
+msgstr "formato data/ora incorretto"
+
+msgid "Empty values not allowed"
+msgstr "Dato obbligatorio"
+
+msgid "Invalid number format"
+msgstr "numero non valido"
+
+#: api.py:335 validators.py:433
+msgid "Please enter a value"
+msgstr "Inserire un dato"
+
+#: api.py:336
+msgid "The input must be a string (not a %(type)s: %(value)r)"
+msgstr "Il dato deve essere una stringa (non un %(type)s: %(value)r)"
+
+#: api.py:337
+msgid "The input must be a string (not None)"
+msgstr "Il dato deve essere una stringa (non nulla)"
+
+#: validators.py:160
+msgid "%(object)r is not a subclass of %(subclass)s"
+msgstr "%(object)r non e' una sottoclasse di %(subclass)s"
+
+#: validators.py:161
+msgid "%(object)r is not a subclass of one of the types %(subclassList)s"
+msgstr "%(object)r non e' una sottoclasse di nessuno dei tipi %(subclassList)s"
+
+#: validators.py:162
+msgid "%(object)r must be one of the types %(typeList)s"
+msgstr "%(object)r deve appartenere ai tipi %(typeList)s"
+
+#: validators.py:163
+msgid "%(object)r must be of the type %(type)s"
+msgstr "%(object)r deve essere del tipo %(type)s"
+
+#: validators.py:344
+msgid "Enter a value less than %(maxLength)i characters long"
+msgstr "Inserire meno di %(maxLength)i caratteri"
+
+#: validators.py:345 validators.py:399
+msgid "Invalid value (value with length expected)"
+msgstr "Dato non valido (dato con lunghezza inaspettata)"
+
+#: validators.py:398
+msgid "Enter a value at least %(minLength)i characters long"
+msgstr "Inserire un dato con al meno %(minLength)i caratteri"
+
+#: validators.py:458
+msgid "You cannot enter a value here"
+msgstr "Impossibile inserire dati qui"
+
+#: validators.py:509
+msgid "The input is not valid"
+msgstr "Il dato non e' valido"
+
+#: validators.py:565
+msgid "Enter only letters, numbers, or _ (underscore)"
+msgstr "Inserire soltanto lettere, numeri o _ (sottolineatura)"
+
+#: validators.py:604
+msgid "Invalid value"
+msgstr "Dato non valido"
+
+#: validators.py:605
+msgid "Value must be one of: %(items)s (not %(value)r)"
+msgstr "Il dato inserito deve essere uno dei seguenti: %(items)s (non %(value)r)"
+
+#: validators.py:668
+msgid "Choose something"
+msgstr "Scegliere qualcosa"
+
+#: validators.py:669
+msgid "Enter a value from: %(items)s"
+msgstr "Inserire uno dei seguenti valori: %(items)s"
+
+#: validators.py:670
+msgid "That value is not known"
+msgstr "Questo dato e' sconosciuto"
+
+#: validators.py:671
+msgid "Nothing in my dictionary goes by the value %(value)s. Choose one of: %(items)s"
+msgstr "Dato inesistente nel mio dizionario %(value)s. Scegliere uno dei seguenti: %(items)s"
+
+#: validators.py:732
+msgid "Must be an integer index"
+msgstr "Deve essere un indice intero"
+
+#: validators.py:733
+msgid "Index out of range"
+msgstr "Indice fuori scala"
+
+#: validators.py:734
+msgid "Item %(value)s was not found in the list"
+msgstr "Elemento %(value)s non trovato nella lista"
+
+#: validators.py:809
+msgid "Date must be after %(date)s"
+msgstr "La data deve essere successiva a %(date)s"
+
+#: validators.py:810
+msgid "Date must be before %(date)s"
+msgstr "La data deve essere precedente a %(date)s"
+
+#: validators.py:812
+msgid "%%A, %%d %%B %%Y"
+msgstr "%%A, %%d di %%B di %%Y"
+
+#: validators.py:813
+msgid "The date must be sometime in the future"
+msgstr "La data deve indicare un tempo futuro"
+
+#: validators.py:913
+msgid "Please enter an integer value"
+msgstr "Inserire un numero intero"
+
+#: validators.py:945
+msgid "Please enter a number"
+msgstr "Inserire un numero"
+
+#: validators.py:998
+msgid "Enter a value less than %(max)i characters long"
+msgstr "Inserire meno di %(max)i caratteri"
+
+#: validators.py:999
+msgid "Enter a value %(min)i characters long or more"
+msgstr "Inserire un valor con almeno %(min)i caratteri"
+
+#: validators.py:1050
+msgid "Invalid data or incorrect encoding"
+msgstr "Dati non validi o codifica errata"
+
+#: validators.py:1178
+msgid "Please enter an email address"
+msgstr "Inserire un indirizzo email"
+
+#: validators.py:1179
+msgid "An email address must contain a single @"
+msgstr "un indirizzo email deve contenere soltanto un @"
+
+#: validators.py:1180
+msgid "The username portion of the email address is invalid (the portion before the @: %(username)s)"
+msgstr "Il nome utente del email non e' valido (la parte prima del @: %(username)s)"
+
+#: validators.py:1181 validators.py:1294
+msgid "An error occured when trying to connect to the server: %(error)s"
+msgstr "Si e' verificato un errore durante il tentativo di collegamento al server: %(error)s"
+
+#: validators.py:1182
+msgid "The domain portion of the email address is invalid (the portion after the @: %(domain)s)"
+msgstr "Il dominio del email non e' valido (la parte dopo il @: %(domain)s)"
+
+#: validators.py:1183
+msgid "The domain of the email address does not exist (the portion after the @: %(domain)s)"
+msgstr "Il dominio del indirizzo email non esiste (la parte dopo il @: %(domain)s)"
+
+#: validators.py:1291
+msgid "You must start your URL with http://, https://, etc"
+msgstr "L'URL deve iniziare con http://, https://, ecc."
+
+#: validators.py:1292
+msgid "That is not a valid URL"
+msgstr "Questo non e' un URL valido"
+
+#: validators.py:1293
+msgid "An error occurred when trying to access the URL: %(error)s"
+msgstr "Si e' verificato un errore durante il tentativo di accesso al URL: %(error)s"
+
+#: validators.py:1295
+msgid "The server responded that the page could not be found"
+msgstr "Il server non riesce a trovare la pagina"
+
+#: validators.py:1296
+msgid "The server responded with a bad status code (%(status)s)"
+msgstr "Il server ha ritornato il codice di errore (%(status)s)"
+
+#: validators.py:1399
+msgid "Please enter a state code"
+msgstr "Inserire la sigla di uno Stado"
+
+#: validators.py:1400
+msgid "Please enter a state code with TWO letters"
+msgstr "Inserire la sigla di uno Stado con DUE lettere"
+
+#: validators.py:1401
+msgid "That is not a valid state code"
+msgstr "Questo non e' uno Stato valido"
+
+#: validators.py:1452
+msgid "Please enter a number, with area code, in the form ###-###-####, optionally with \"ext.####\""
+msgstr "Inserire un numero con il codice area nel formato ###-###-####, opzionalmente con \"ext.###\""
+
+#: validators.py:1614 validators.py:1622
+msgid "Please enter the date in the form %(format)s"
+msgstr "Inserire una data nel formato %(format)s"
+
+#: validators.py:1615
+msgid "Please enter a month from 1 to 12"
+msgstr "Inserire il mese tra 1 e 12"
+
+#: validators.py:1616
+msgid "Please enter a valid day"
+msgstr "Inserire un giorno valido"
+
+#: validators.py:1617
+msgid "That month only has %(days)i days"
+msgstr "Questo mese ha soltanto %(days)i giorni"
+
+#: validators.py:1618
+msgid "That is not a valid day (%(exception)s)"
+msgstr "Questo non e' un giorno valido (%(exception)s)"
+
+#: validators.py:1619
+msgid "Unknown month name: %(month)s"
+msgstr "Nome di mese sconosciuto: %(month)s"
+
+#: validators.py:1620
+msgid "Please enter a number for the year"
+msgstr "Inserire un numero per l'anno"
+
+#: validators.py:1621
+msgid "Please enter a four-digit year"
+msgstr "Inserire l'anno di quattro cifre"
+
+#: validators.py:1800
+msgid "You must indicate AM or PM"
+msgstr "Indicare AM o PM"
+
+#: validators.py:1801
+msgid "There are too many :'s"
+msgstr "Ci sono troppe: ''' (virgolette)"
+
+#: validators.py:1802
+msgid "You may not enter seconds"
+msgstr "Non puoi inserire i secondi"
+
+#: validators.py:1803
+msgid "You must enter seconds"
+msgstr "Devi inserire i secondi"
+
+#: validators.py:1804
+msgid "You must enter minutes (after a :)"
+msgstr "Inserire i minuti ( dopo i : )"
+
+#: validators.py:1805
+msgid "The %(part)s value you gave is not a number: %(number)r"
+msgstr "%(part), non e' un numero: %(number)r"
+
+#: validators.py:1806
+msgid "You must enter an hour in the range %(range)s"
+msgstr "Devi inserire un'ora tra %(range)s"
+
+#: validators.py:1807
+msgid "You must enter a minute in the range 0-59"
+msgstr "Devi inserire i minuti tra 0-59"
+
+#: validators.py:1808
+msgid "You must enter a second in the range 0-59"
+msgstr "Devi inserire i secondi tra 0-59"
+
+#: validators.py:1962
+msgid "Please enter a zip code (5 digits)"
+msgstr "Inserire un codice postale valido (5 cifre)"
+
+#: validators.py:1986
+msgid "The name %(name)s is missing"
+msgstr "Manca il nome %(name)s"
+
+#: validators.py:2027
+msgid "Value should be %(true)r or %(false)r"
+msgstr "Il dato deve essere %(true)r o %(false)r"
+
+#: validators.py:2062
+msgid "Value does not contain a signature"
+msgstr "Il dato non contiene una firma"
+
+#: validators.py:2063
+msgid "Signature is not correct"
+msgstr "La firma non e' valida"
+
+#: validators.py:2185
+msgid "Fields do not match (should be %(match)s)"
+msgstr "I campi non corrispondono (dovrebbero essere %(match)s)"
+
+#: validators.py:2186
+msgid "Fields do not match"
+msgstr "I campi non corrispondono"
+
+#: validators.py:2248
+msgid "Please enter only the number, no other characters"
+msgstr "Inserire soltanto numeri, nessun altro carattere"
+
+#: validators.py:2249
+msgid "You did not enter a valid number of digits"
+msgstr "Numero di cifre non valida"
+
+#: validators.py:2250
+msgid "That number is not valid"
+msgstr "Numero non valido"
+
+#: validators.py:2365
+msgid "Please enter numbers only for month and year"
+msgstr "Inserire numeri solo per il mese e anno"
+
+#: validators.py:2366
+msgid "Invalid Expiration Date"
+msgstr "Data di scadenza non valida"
+
+#: validators.py:2435
+msgid "Please enter numbers only for credit card security code"
+msgstr "Inserire solo numeri nel codice di sicurezza della carta di credito"
+
+#: validators.py:2436
+msgid "Invalid credit card security code length"
+msgstr "Lunghezza del codice di sicurezza della carta di credito non valido"
+
Added: FormEncode/trunk/formencode/i18n/nb_NO/LC_MESSAGES/FormEncode.mo
===================================================================
(Binary files differ)
Property changes on: FormEncode/trunk/formencode/i18n/nb_NO/LC_MESSAGES/FormEncode.mo
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: FormEncode/trunk/formencode/i18n/nb_NO/LC_MESSAGES/FormEncode.po
===================================================================
--- FormEncode/trunk/formencode/i18n/nb_NO/LC_MESSAGES/FormEncode.po (rev 0)
+++ FormEncode/trunk/formencode/i18n/nb_NO/LC_MESSAGES/FormEncode.po 2008-02-17 06:37:35 UTC (rev 3259)
@@ -0,0 +1,324 @@
+# Norsk oversettelse av FormEncode
+# Dag Brattli <da...@ob...>, 2008.
+# Copyright (C) 2008 ObexCode
+
+msgid ""
+msgstr ""
+"Project-Id-Version: FormEncode 0.9\n"
+"POT-Creation-Date: 2006-10-02 20:59+0100\n"
+"PO-Revision-Date: 2008-01-01 20:21+0100\n"
+"Last-Translator: Dag Brattli <da...@ob...>\n"
+"Language-Team: Dag Brattli <da...@ob...>, Frank Ronny Larsen <fr...@ob...>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: pygettext.py 1.5\n"
+
+
+#: api.py:335 validators.py:433
+msgid "Please enter a value"
+msgstr "Venligst fyll inn en verdi"
+
+#: api.py:336
+msgid "The input must be a string (not a %(type)s: %(value)r)"
+msgstr "Det du fylte inn må være tekst (ikke %(type)s: %(value)r))"
+
+#: api.py:337
+msgid "The input must be a string (not None)"
+msgstr "Det du fyller inn være tekst (ikke tomt)"
+
+#: validators.py:160
+msgid "%(object)r is not a subclass of %(subclass)s"
+msgstr "%(object)r er ikke en subklasse av %(subclass)s"
+
+#: validators.py:161
+msgid "%(object)r is not a subclass of one of the types %(subclassList)s"
+msgstr "%(object)r er ikke en subklasse av en av typene %(subclassList)s"
+
+#: validators.py:162
+msgid "%(object)r must be one of the types %(typeList)s"
+msgstr "%(object)r må være en av typene %(typeList)s"
+
+#: validators.py:163
+msgid "%(object)r must be of the type %(type)s"
+msgstr "%(object)r må være av type %(type)s"
+
+#: validators.py:344
+msgid "Enter a value less than %(maxLength)i characters long"
+msgstr "Skriv inn en verdi som er mindre enn %(maxLength)i tegn"
+
+#: validators.py:345 validators.py:399
+msgid "Invalid value (value with length expected)"
+msgstr "Ugyldig verdi (forventet en verdi med lengde)"
+
+#: validators.py:398
+msgid "Enter a value at least %(minLength)i characters long"
+msgstr "Skriv inn en verdi som er på minst %(minLength)i tegn"
+
+#: validators.py:458
+msgid "You cannot enter a value here"
+msgstr "Du kan ikke skrive en verdi her"
+
+#: validators.py:509
+msgid "The input is not valid"
+msgstr "Verdien er ikke gyldig"
+
+#: validators.py:565
+msgid "Enter only letters, numbers, or _ (underscore)"
+msgstr "Bare skriv inn tegn, tall, eller _ (understreking)"
+
+#: validators.py:604
+msgid "Invalid value"
+msgstr "Ugyldig verdi"
+
+#: validators.py:605
+msgid "Value must be one of: %(items)s (not %(value)r)"
+msgstr "Verdien må være en av: %(items)s (ikke %(value)r)"
+
+#: validators.py:668
+msgid "Choose something"
+msgstr "Velg noe"
+
+#: validators.py:669
+msgid "Enter a value from: %(items)s"
+msgstr "Velg en verdi fra: %(items)s"
+
+#: validators.py:670
+msgid "That value is not known"
+msgstr "Den verdien er ikke kjent"
+
+#: validators.py:671
+msgid "Nothing in my dictionary goes by the value %(value)s. Choose one of: %(items)s"
+msgstr "Ingenting i min ordliste har verdien %(value)s. Velg en av: %(items)s"
+
+#: validators.py:732
+msgid "Must be an integer index"
+msgstr "Må være en heltallsindeks"
+
+#: validators.py:733
+msgid "Index out of range"
+msgstr "Indeks er utenfor grensene"
+
+#: validators.py:734
+msgid "Item %(value)s was not found in the list"
+msgstr "Oppføringen %(value)s ble ikke funnet i listen"
+
+#: validators.py:809
+msgid "Date must be after %(date)s"
+msgstr "Datoen må være etter %(date)s"
+
+#: validators.py:810
+msgid "Date must be before %(date)s"
+msgstr "Datoen må være før %(date)s"
+
+#: validators.py:812
+msgid "%%A, %%d %%B %%Y"
+msgstr "%%A, %%d. %%B %%Y"
+
+#: validators.py:813
+msgid "The date must be sometime in the future"
+msgstr "Datoen må være i fremtiden"
+
+#: validators.py:913
+msgid "Please enter an integer value"
+msgstr "Vennligst skriv inn en heltallsverdi"
+
+#: validators.py:945
+msgid "Please enter a number"
+msgstr "Vennligst skriv inn et nummer"
+
+#: validators.py:998
+msgid "Enter a value less than %(max)i characters long"
+msgstr "Skriv inn en verdi som er mindre enn %(max)i tegn"
+
+#: validators.py:999
+msgid "Enter a value %(min)i characters long or more"
+msgstr "Skriv inn en verdi som er %(min)i tegn eller mer"
+
+#: validators.py:1050
+msgid "Invalid data or incorrect encoding"
+msgstr "Ugyldig data eller feil koding"
+
+#: validators.py:1178
+msgid "Please enter an email address"
+msgstr "Vennligst skriv inn en epostadresse"
+
+#: validators.py:1179
+msgid "An email address must contain a single @"
+msgstr "En epostadresse må inneholde en @"
+
+#: validators.py:1180
+msgid "The username portion of the email address is invalid (the portion before the @: %(username)s)"
+msgstr "Brukernavnet i epostadressen er ugyldig (den delen før @: %(username)s)"
+
+#: validators.py:1181 validators.py:1294
+msgid "An error occured when trying to connect to the server: %(error)s"
+msgstr "En feil oppstod ved oppkobling til tjeneren: %(error)s"
+
+#: validators.py:1182
+msgid "The domain portion of the email address is invalid (the portion after the @: %(domain)s)"
+msgstr "Domenet i epostadressen er ugyldig (den delen etter @: %(domain)s)"
+
+#: validators.py:1183
+msgid "The domain of the email address does not exist (the portion after the @: %(domain)s)"
+msgstr "Domenet i epostadressen eksister ikke (den delen etter @: %(domain)s)"
+
+#: validators.py:1291
+msgid "You must start your URL with http://, https://, etc"
+msgstr "Du må starte din URL med http://, https://, o.l."
+
+#: validators.py:1292
+msgid "That is not a valid URL"
+msgstr "Det er ikke en gyldig URL"
+
+#: validators.py:1293
+msgid "An error occurred when trying to access the URL: %(error)s"
+msgstr "En feil oppstod ved tilgang til URL'en: %(error)s"
+
+#: validators.py:1295
+msgid "The server responded that the page could not be found"
+msgstr "Tjeneren ga tilbakemelding om at siden ikke kunne finnes"
+
+#: validators.py:1296
+msgid "The server responded with a bad status code (%(status)s)"
+msgstr "Tjeneren ga tilbakemelding med feilkode (%(status)s)"
+
+#: validators.py:1399
+msgid "Please enter a state code"
+msgstr "Vennligst skriv inn statskoden"
+
+#: validators.py:1400
+msgid "Please enter a state code with TWO letters"
+msgstr "Vennligst skriv inn en statskode med TO bokstaver"
+
+#: validators.py:1401
+msgid "That is not a valid state code"
+msgstr "Det er ikke en gyldig statskode"
+
+#: validators.py:1452
+msgid "Please enter a number, with area code, in the form ###-###-####, optionally with \"ext.####\""
+msgstr "Vennligst skriv inn et nummer, med retningsummer, på formen ###-###-####, eller med \"ext.####\""
+
+#: validators.py:1614 validators.py:1622
+msgid "Please enter the date in the form %(format)s"
+msgstr "Vennligst skriv inn datoen på formen %(format)s"
+
+#: validators.py:1615
+msgid "Please enter a month from 1 to 12"
+msgstr "Vennligst skriv inn en måned fra 1 til 12"
+
+#: validators.py:1616
+msgid "Please enter a valid day"
+msgstr "Vennligst skriv inn en gyldig dag"
+
+#: validators.py:1617
+msgid "That month only has %(days)i days"
+msgstr "Den måneden har bare %(days)i dager"
+
+#: validators.py:1618
+msgid "That is not a valid day (%(exception)s)"
+msgstr "Det er ikke en gyldig dag (%(exception)s)"
+
+#: validators.py:1619
+msgid "Unknown month name: %(month)s"
+msgstr "Ukjent navn på måned: %(month)s"
+
+#: validators.py:1620
+msgid "Please enter a number for the year"
+msgstr "Vennligst skriv inn et tall for året"
+
+#: validators.py:1621
+msgid "Please enter a four-digit year"
+msgstr "Vennligst skriv inn et firesifferet årstall"
+
+#: validators.py:1800
+msgid "You must indicate AM or PM"
+msgstr "Du må indikere AM eller PM"
+
+#: validators.py:1801
+msgid "There are too many :'s"
+msgstr "Det er for mange :'er"
+
+#: validators.py:1802
+msgid "You may not enter seconds"
+msgstr "Du kan ikke skrive inn sekunder"
+
+#: validators.py:1803
+msgid "You must enter seconds"
+msgstr "Du må skrive inn sekunder"
+
+#: validators.py:1804
+msgid "You must enter minutes (after a :)"
+msgstr "Du må skrive minutter (etter en :)"
+
+#: validators.py:1805
+msgid "The %(part)s value you gave is not a number: %(number)r"
+msgstr "Den %(part)s verdien du ga er ikke et tall: %(number)r"
+
+#: validators.py:1806
+msgid "You must enter an hour in the range %(range)s"
+msgstr "Du må skrive inn en time mellom %(range)s"
+
+#: validators.py:1807
+msgid "You must enter a minute in the range 0-59"
+msgstr "Du må skrive inn minuttet mellom 0-59"
+
+#: validators.py:1808
+msgid "You must enter a second in the range 0-59"
+msgstr "Du må skrive inn sekunder i området 0-59"
+
+#: validators.py:1962
+msgid "Please enter a zip code (5 digits)"
+msgstr "Vennligst skriv inn en zipkode (5 siffer)"
+
+#: validators.py:1986
+msgid "The name %(name)s is missing"
+msgstr "Navnet %(name)s mangler"
+
+#: validators.py:2027
+msgid "Value should be %(true)r or %(false)r"
+msgstr "Verdien skal være %(true)r eller %(false)r"
+
+#: validators.py:2062
+msgid "Value does not contain a signature"
+msgstr "Verdien inneholder ikke en signatur"
+
+#: validators.py:2063
+msgid "Signature is not correct"
+msgstr "Signaturen er ikke riktig"
+
+#: validators.py:2185
+msgid "Fields do not match (should be %(match)s)"
+msgstr "Feltene er ikke like (skal være %(match)s)"
+
+#: validators.py:2186
+msgid "Fields do not match"
+msgstr "Feltene er ikke like"
+
+#: validators.py:2248
+msgid "Please enter only the number, no other characters"
+msgstr "Vennligst bare skriv inn tallet, og ingen andre tegn"
+
+#: validators.py:2249
+msgid "You did not enter a valid number of digits"
+msgstr "Du skrev ikke inn et gyldig antall siffer"
+
+#: validators.py:2250
+msgid "That number is not valid"
+msgstr "Det nummeret er ikke gyldig"
+
+#: validators.py:2365
+msgid "Please enter numbers only for month and year"
+msgstr "Vennligst bare skriv inn nummerene for måned og år"
+
+#: validators.py:2366
+msgid "Invalid Expiration Date"
+msgstr "Ugyldig utløpsdato"
+
+#: validators.py:2435
+msgid "Please enter numbers only for credit card security code"
+msgstr "Vennligst bare skriv inn tall for kredittkort og sikkerhetskode"
+
+#: validators.py:2436
+msgid "Invalid credit card security code length"
+msgstr "Ugyldig lengde på sikkerhetskoden til kredittkortet"
Modified: FormEncode/trunk/tests/test_i18n.py
===================================================================
--- FormEncode/trunk/tests/test_i18n.py 2008-02-14 16:11:14 UTC (rev 3258)
+++ FormEncode/trunk/tests/test_i18n.py 2008-02-17 06:37:35 UTC (rev 3259)
@@ -99,3 +99,12 @@
def test_cs():
_test_lang("cs", u"Prosím zadejte hodnotu")
+def test_fi():
+ _test_lang("fi", u"Anna arvo")
+
+def test_nb_NO():
+ _test_lang("nb_NO", u"Venligst fyll inn en verdi")
+
+def test_it():
+ _test_lang("it", u"Inserire un dato")
+
|
|
From: <sub...@co...> - 2008-02-02 17:35:31
|
Author: ianb
Date: 2008-02-02 10:35:32 -0700 (Sat, 02 Feb 2008)
New Revision: 3240
Modified:
FormEncode/trunk/docs/Validator.txt
FormEncode/trunk/docs/news.txt
FormEncode/trunk/formencode/schema.py
FormEncode/trunk/tests/test_schema.py
Log:
Changed the algorithm a bit for how chained validators are called, so they are called even if there are previous errors; from hax
Modified: FormEncode/trunk/docs/Validator.txt
===================================================================
--- FormEncode/trunk/docs/Validator.txt 2008-02-01 14:48:56 UTC (rev 3239)
+++ FormEncode/trunk/docs/Validator.txt 2008-02-02 17:35:32 UTC (rev 3240)
@@ -217,13 +217,20 @@
``chained_validators`` are validators that are run on the entire
dictionary after other validation is done (``pre_validators`` are
-applied before the schema validation). You could actually achieve the
-same thing by using ``All`` with the schema validators (`FieldsMatch
-<class-formencode.validators.FieldsMatch.html>`_ is just another
-validator that can be applied to dictionaries). In this case
-``validators.FieldsMatch`` checks that the value of the two fields are
-the same (i.e., that the password matches the confirmation).
+applied before the schema validation). chained_validtors will also
+allow for multiple validators to fail and report to the error_dict
+so, for example, if you have an email_confirm and a password_confirm
+fields and use FieldsMatch on both of them as follows:
+ >>> chained_validators [ validators.FieldsMatch('password',
+ ... 'password_confirm'),
+ ... validators.FieldsMatch('email',
+ ... 'email_confirm') ]
+
+This will leave the error_dict with both password_confirm and
+email_confirm error keys, which is likely the desired behavior
+for web forms.
+
Since a `Schema <class-formencode.schema.Schema.html>`_ is just
another kind of validator, you can nest these indefinitely, validating
dictionaries of dictionaries.
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2008-02-01 14:48:56 UTC (rev 3239)
+++ FormEncode/trunk/docs/news.txt 2008-02-02 17:35:32 UTC (rev 3240)
@@ -9,6 +9,10 @@
* Added ``formencode.schema.SimpleFormValidator``, which wraps a
simple function to make it a validator.
+* Changed the use of ``chained_validators`` in Schemas, so that all
+ chained validators get run even when there are previous errors (to
+ detect all the errors).
+
0.9
---
Modified: FormEncode/trunk/formencode/schema.py
===================================================================
--- FormEncode/trunk/formencode/schema.py 2008-02-01 14:48:56 UTC (rev 3239)
+++ FormEncode/trunk/formencode/schema.py 2008-02-02 17:35:32 UTC (rev 3240)
@@ -177,19 +177,18 @@
else:
new[name] = validator.if_missing
- if errors:
- for validator in self.chained_validators:
- if (not hasattr(validator, 'validate_partial')
- or not getattr(validator, 'validate_partial_form', False)):
+ for validator in self.chained_validators:
+ if (not hasattr(validator, 'validate_partial')
+ or not getattr(validator, 'validate_partial_form', False)):
+ continue
+ try:
+ validator.validate_partial(value_dict, state)
+ except Invalid, e:
+ sub_errors = e.unpack_errors()
+ if not isinstance(sub_errors, dict):
+ # Can't do anything here
continue
- try:
- validator.validate_partial(value_dict, state)
- except Invalid, e:
- sub_errors = e.unpack_errors()
- if not isinstance(sub_errors, dict):
- # Can't do anything here
- continue
- merge_dicts(errors, sub_errors)
+ merge_dicts(errors, sub_errors)
if errors:
raise Invalid(
@@ -197,9 +196,6 @@
value_dict, state,
error_dict=errors)
- for validator in self.chained_validators:
- new = validator.to_python(new, state)
-
return new
finally:
Modified: FormEncode/trunk/tests/test_schema.py
===================================================================
--- FormEncode/trunk/tests/test_schema.py 2008-02-01 14:48:56 UTC (rev 3239)
+++ FormEncode/trunk/tests/test_schema.py 2008-02-02 17:35:32 UTC (rev 3240)
@@ -149,4 +149,19 @@
== dict(a=['a1\naa1', 'a2'], b=['b\nbb', 'bbb'],
c=['c']))
+class ChainedTest(Schema):
+ a = validators.String()
+ a_confirm = validators.String()
+ b = validators.String()
+ b_confirm = validators.String()
+
+ chained_validators = [validators.FieldsMatch('a', 'a_confirm'),
+ validators.FieldsMatch('b', 'b_confirm')]
+
+def test_multiple_chained_validators_errors():
+ try:
+ s = ChainedTest()
+ s.to_python({'a':'1', 'a_confirm':'2', 'b':'3', 'b_confirm':'4'})
+ except Invalid, e:
+ assert(e.error_dict.has_key('a_confirm') and e.error_dict.has_key('b_confirm'))
|
|
From: <sub...@co...> - 2007-12-30 22:36:15
|
Author: ianb
Date: 2007-12-30 15:36:17 -0700 (Sun, 30 Dec 2007)
New Revision: 3186
Modified:
FormEncode/trunk/docs/Validator.txt
FormEncode/trunk/formencode/schema.py
Log:
added partial forms for SimpleFormValidator; added docs for it
Modified: FormEncode/trunk/docs/Validator.txt
===================================================================
--- FormEncode/trunk/docs/Validator.txt 2007-12-30 18:30:28 UTC (rev 3185)
+++ FormEncode/trunk/docs/Validator.txt 2007-12-30 22:36:17 UTC (rev 3186)
@@ -228,6 +228,35 @@
another kind of validator, you can nest these indefinitely, validating
dictionaries of dictionaries.
+.. _SimpleFormValidator:
+
+Another way to do simple validation of a complete form is with
+``formencode.schema.SimpleFormValidator``. This class wraps a simple
+function that you write. For example::
+
+ >>> from formencode.schema import SimpleFormValidator
+ >>> def validate_state(value_dict, state, validator):
+ ... if value_dict.get('country', 'US') == 'US':
+ ... if not value_dict.get('state'):
+ ... return {'state': 'You must enter a state'}
+ >>> ValidateState = SimpleFormValidator(validate_state)
+ >>> ValidateState.to_python({'country': 'US'}, None)
+
+The ``validate_state`` function (or any validation function) returns
+any errors in the form (or it may raise Invalid directly). It can
+also modify the ``value_dict`` dictionary directly. When it returns
+None this indicates that everything is valid. You can use this with a
+``Schema`` by putting ``ValidateState`` in ``pre_validators`` (all
+validation will be done before the schema's validation, and if there's
+an error the schema won't be run). Or you can put it in
+``chained_validators`` and it will be run *after* the schema. If the
+schema fails (the values are invalid) then ``ValidateState`` will not
+be run, unless you set ``validate_partial_form`` to True (like
+``ValidateState = SimpleFormValidator(validate_state,
+validate_partial_form=True). If you validate a partial form you
+should be careful that you handle missing keys and other
+possibly-invalid values gracefully.
+
.. _ForEach:
You can also validate lists of items using `ForEach
Modified: FormEncode/trunk/formencode/schema.py
===================================================================
--- FormEncode/trunk/formencode/schema.py 2007-12-30 18:30:28 UTC (rev 3185)
+++ FormEncode/trunk/formencode/schema.py 2007-12-30 22:36:17 UTC (rev 3186)
@@ -433,7 +433,12 @@
__unpackargs__ = ('func',)
+ validate_partial_form = False
+
def to_python(self, value_dict, state):
+ # Since we aren't really supposed to modify things in-place,
+ # we'll give the validation function a copy:
+ value_dict = value_dict.copy()
errors = self.func(value_dict, state, self)
if not errors:
return value_dict
|
|
From: <sub...@co...> - 2007-12-30 18:30:28
|
Author: ianb
Date: 2007-12-30 11:30:28 -0700 (Sun, 30 Dec 2007)
New Revision: 3185
Modified:
FormEncode/trunk/docs/news.txt
FormEncode/trunk/formencode/schema.py
FormEncode/trunk/tests/test_doctests.py
Log:
Added SimpleFormValidator
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2007-12-26 12:31:08 UTC (rev 3184)
+++ FormEncode/trunk/docs/news.txt 2007-12-30 18:30:28 UTC (rev 3185)
@@ -3,6 +3,12 @@
.. contents::
+svn trunk
+---------
+
+* Added ``formencode.schema.SimpleFormValidator``, which wraps a
+ simple function to make it a validator.
+
0.9
---
Modified: FormEncode/trunk/formencode/schema.py
===================================================================
--- FormEncode/trunk/formencode/schema.py 2007-12-26 12:31:08 UTC (rev 3184)
+++ FormEncode/trunk/formencode/schema.py 2007-12-30 18:30:28 UTC (rev 3185)
@@ -382,3 +382,75 @@
item = merge_values(l1item, l2item)
result.append(item)
return result
+
+class SimpleFormValidator(FancyValidator):
+ """
+ This validator wraps a simple function that validates the form.
+
+ The function looks something like this::
+
+ >>> def validate(form_values, state, validator):
+ ... if form_values.get('country', 'US') == 'US':
+ ... if not form_values.get('state'):
+ ... return {'state': 'You must enter a state'}
+ ... if not form_values.get('country'):
+ ... form_values['country'] = 'US'
+
+ This tests that the field 'state' must be filled in if the country
+ is US, and defaults that country value to 'US'. The ``validator``
+ argument is the SimpleFormValidator instance, which you can use to
+ format messages or keep configuration state in if you like (for
+ simple ad hoc validation you are unlikely to need it).
+
+ To create a validator from that function, you would do::
+
+ >>> from formencode.schema import SimpleFormValidator
+ >>> validator = SimpleFormValidator(validate)
+ >>> validator.to_python({'country': 'US', 'state': ''}, None)
+ Traceback (most recent call last):
+ ...
+ Invalid: state: You must enter a state
+ >>> validator.to_python({'state': 'IL'}, None)
+ {'country': 'US', 'state': 'IL'}
+
+ The validate function can either return a single error message
+ (that applies to the whole form), a dictionary that applies to the
+ fields, None which means the form is valid, or it can raise
+ Invalid.
+
+ Note that you may update the value_dict *in place*, but you cannot
+ return a new value.
+
+ Another way to instantiate a validator is like this::
+
+ >>> @SimpleFormValidator.decorate()
+ ... def MyValidator(value_dict, state):
+ ... return None # or some more useful validation
+
+ After this ``MyValidator`` will be a ``SimpleFormValidator``
+ instance (it won't be your function).
+ """
+
+ __unpackargs__ = ('func',)
+
+ def to_python(self, value_dict, state):
+ errors = self.func(value_dict, state, self)
+ if not errors:
+ return value_dict
+ if isinstance(errors, basestring):
+ raise Invalid(errors, value_dict, state)
+ elif isinstance(errors, dict):
+ raise Invalid(format_compound_error(errors),
+ value_dict, state, error_dict=errors)
+ elif isinstance(errors, Invalid):
+ raise errors
+ else:
+ raise TypeError(
+ "Invalid error value: %r" % errors)
+
+ def decorate(cls, **kw):
+ def decorator(func):
+ return cls(func, **kw)
+ return decorator
+
+ decorate = classmethod(decorate)
Modified: FormEncode/trunk/tests/test_doctests.py
===================================================================
--- FormEncode/trunk/tests/test_doctests.py 2007-12-26 12:31:08 UTC (rev 3184)
+++ FormEncode/trunk/tests/test_doctests.py 2007-12-30 18:30:28 UTC (rev 3185)
@@ -21,7 +21,8 @@
]
from formencode import validators
-modules = [validators]
+from formencode import schema
+modules = [validators, schema]
if __name__ == '__main__':
import sys
|
|
From: <sub...@co...> - 2007-12-17 23:26:10
|
Author: ianb Date: 2007-12-17 16:26:07 -0700 (Mon, 17 Dec 2007) New Revision: 3182 Modified: FormEncode/trunk/setup.cfg Log: add pudge setup, and distribute alias Modified: FormEncode/trunk/setup.cfg =================================================================== --- FormEncode/trunk/setup.cfg 2007-12-17 19:32:17 UTC (rev 3181) +++ FormEncode/trunk/setup.cfg 2007-12-17 23:26:07 UTC (rev 3182) @@ -1,6 +1,9 @@ [easy_install] find_links = http://svn.pythonpaste.org/package_index.html +[global] +command_packages = buildutils.pudge_command, buildutils.publish_command + [egg_info] tag_build = dev tag_svn_revision = true @@ -35,3 +38,6 @@ [publish] doc-dir = docs/html doc-dest = scp://ianbicking@shell.sf.net/home/groups/f/fo/formencode/htdocs/ + +[aliases] +distribute = register sdist bdist_egg upload pudge publish |
|
From: <sub...@co...> - 2007-12-17 19:32:36
|
Author: ianb
Date: 2007-12-17 12:32:17 -0700 (Mon, 17 Dec 2007)
New Revision: 3181
Modified:
FormEncode/trunk/setup.py
Log:
Auto-update of version strings
Modified: FormEncode/trunk/setup.py
===================================================================
--- FormEncode/trunk/setup.py 2007-12-17 19:32:15 UTC (rev 3180)
+++ FormEncode/trunk/setup.py 2007-12-17 19:32:17 UTC (rev 3181)
@@ -5,7 +5,7 @@
use_setuptools()
from setuptools import setup
-version = '0.7.2'
+version = '0.9.1'
setup(name="FormEncode",
version=version,
|
|
From: <sub...@co...> - 2007-12-17 19:32:20
|
Author: ianb Date: 2007-12-17 12:32:15 -0700 (Mon, 17 Dec 2007) New Revision: 3180 Modified: FormEncode/tags/0.9/setup.cfg FormEncode/tags/0.9/setup.py Log: Auto-update of version strings Modified: FormEncode/tags/0.9/setup.cfg =================================================================== --- FormEncode/tags/0.9/setup.cfg 2007-12-17 19:32:04 UTC (rev 3179) +++ FormEncode/tags/0.9/setup.cfg 2007-12-17 19:32:15 UTC (rev 3180) @@ -1,37 +1,33 @@ [easy_install] find_links = http://svn.pythonpaste.org/package_index.html -[egg_info] -tag_build = dev -tag_svn_revision = true - [pudge] -theme = pythonpaste.org -docs = docs/index.txt docs/Validator.txt docs/ToDo.txt - docs/news.txt docs/htmlfill.txt docs/Design.txt - docs/community.txt docs/download.txt - docs/history.txt docs/i18n.txt -doc_base = docs/ +organization = FormEncode +title = FormEncode dest = docs/html +docs = docs/index.txt docs/Validator.txt docs/ToDo.txt + docs/news.txt docs/htmlfill.txt docs/Design.txt + docs/community.txt docs/download.txt + docs/history.txt docs/i18n.txt +settings = normal_link_color=#083 + visited_color=#038 + hover_color=#dfd + body_outer_bg_color=#173 + body_border_color=#0f0 + nav_container_color=#7d9 + nav_button_color=#073 + nav_border_color=#0f5 + doctitle_color=#009900 + no_about=true + link1=/Validator.html Documentation modules = formencode -exclude_modules = formencode.fields formencode.formgen - formencode.sqlformgen formencode.sqlschema -title = FormEncode +doc_base = docs/ +theme = pythonpaste.org mailing_list_url = http://formencode.org/community.html -organization = FormEncode -settings = normal_link_color=#083 - visited_color=#038 - hover_color=#dfd - body_outer_bg_color=#173 - body_border_color=#0f0 - nav_container_color=#7d9 - nav_button_color=#073 - nav_border_color=#0f5 - doctitle_color=#009900 +exclude_modules = formencode.fields formencode.formgen + formencode.sqlformgen formencode.sqlschema - no_about=true - link1=/Validator.html Documentation - [publish] -doc-dir = docs/html doc-dest = scp://ianbicking@shell.sf.net/home/groups/f/fo/formencode/htdocs/ +doc-dir = docs/html + Modified: FormEncode/tags/0.9/setup.py =================================================================== --- FormEncode/tags/0.9/setup.py 2007-12-17 19:32:04 UTC (rev 3179) +++ FormEncode/tags/0.9/setup.py 2007-12-17 19:32:15 UTC (rev 3180) @@ -5,7 +5,7 @@ use_setuptools() from setuptools import setup -version = '0.7.2' +version = '0.9' setup(name="FormEncode", version=version, |
|
From: <sub...@co...> - 2007-12-17 19:32:12
|
Author: ianb Date: 2007-12-17 12:32:04 -0700 (Mon, 17 Dec 2007) New Revision: 3179 Added: FormEncode/tags/0.9/ Log: Tagging 0.9 version Copied: FormEncode/tags/0.9 (from rev 3178, FormEncode/trunk) |
|
From: <sub...@co...> - 2007-12-17 19:30:07
|
Author: ianb
Date: 2007-12-17 12:29:58 -0700 (Mon, 17 Dec 2007)
New Revision: 3178
Modified:
FormEncode/trunk/docs/news.txt
FormEncode/trunk/formencode/validators.py
Log:
Updated and categorized news for 0.9; fixed some doctests
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2007-12-14 13:28:01 UTC (rev 3177)
+++ FormEncode/trunk/docs/news.txt 2007-12-17 19:29:58 UTC (rev 3178)
@@ -3,9 +3,20 @@
.. contents::
-svn trunk
----------
+0.9
+---
+Backward incompatible changes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* The notion of "empty" has changed to include empty lists,
+ dictionaries, and tuples. If you get one of these values passed
+ into (or generated by) a validator with ``not_empty=True`` you can
+ get exceptions where you didn't previously.
+
+Enhancements
+~~~~~~~~~~~~
+
* Added support for Paste's MultiDict dictionary as input to
Schema.to_python, by converting it to a normal dict via MultiDict.mixed.
Previously MultiDicts wouldn't work with CompoundValidators (like
@@ -14,6 +25,22 @@
* Added encoding parameter to htmlfill, which will handle cases when mixed
str and unicode objects are used (turning all str objects into unicode)
+* Include ``formencode.validators.InternationalPhoneNumber`` from
+ W-Mark Kubacki.
+
+* ``validators.Int`` takes ``min`` and ``max`` options (from Felix
+ Schwarz).
+
+* You can control the missing message (which by default is just
+ "Missing Value") using the message ``"missing"`` in a validator
+ (also from James Gardner).
+
+* Added ``validators.CADR`` (for IP addresses with an optional range)
+ and ``validators.MACAddress`` (from Christoph Haas).
+
+Bug Fixes
+~~~~~~~~~
+
* Be friendlier when loaded from a zip file (as with py2exe);
previously only egg zip files would work.
@@ -25,11 +52,6 @@
* Fix problem with looking up A records for email addresses.
-* Include ``formencode.validators.InternationalPhoneNumber`` from
- W-Mark Kubacki.
-
-* Treat empty lists/tuples/dicts as "empty".
-
* ``validators.String`` now always returns strings. It also converts
lists to comma-separated strings (no ``[...]``), and can encode
unicode if an ``encoding`` parameter is given. Empty values are
@@ -37,22 +59,12 @@
* ``validators.UnicodeString`` properly handles non-Unicode inputs.
-* ``validators.Int`` takes ``min`` and ``max`` options (from Felix
- Schwarz).
+* Make ``validators.DateConverter`` serialize dates properly
+ (from James Gardner).
-* Make ``validators.DateConverter`` serialize dates properly (from
- James Gardner).
-
-* You can control the missing message (which by default is just
- "Missing Value") using the message ``"missing"`` in a validator
- (also from James Gardner).
-
* Minor fix to setup.py to make FormEncode more friendly with
zc.buildout.
-* Added ``validators.CADR`` (for IP addresses with an optional range)
- and ``validators.MACAddress`` (from Christoph Haas).
-
0.7.1
-----
Modified: FormEncode/trunk/formencode/validators.py
===================================================================
--- FormEncode/trunk/formencode/validators.py 2007-12-14 13:28:01 UTC (rev 3177)
+++ FormEncode/trunk/formencode/validators.py 2007-12-17 19:29:58 UTC (rev 3178)
@@ -1552,7 +1552,7 @@
::
- >>> p = IPhoneNumberValidator()
+ >>> p = IPhoneNumberValidator(default_cc=49)
>>> p.to_python('333-3333')
Traceback (most recent call last):
...
@@ -2366,7 +2366,7 @@
Examples::
- >>> mac = MacAddress()
+ >>> mac = MACAddress()
>>> mac.to_python('aa:bb:cc:dd:ee:ff')
'aabbccddeeff'
>>> mac.to_python('aa:bb:cc:dd:ee:ff:e')
@@ -2377,7 +2377,7 @@
Traceback (most recent call last):
...
Invalid: MAC addresses may only contain 0-9 and A-F (and optionally :), not 'x'
- >>> MacAddress(add_colons=True).to_python('aabbccddeeff')
+ >>> MACAddress(add_colons=True).to_python('aabbccddeeff')
'aa:bb:cc:dd:ee:ff'
"""
|
|
From: <sub...@co...> - 2007-11-20 17:52:04
|
Author: ianb
Date: 2007-11-20 10:52:04 -0700 (Tue, 20 Nov 2007)
New Revision: 3157
Modified:
FormEncode/trunk/formencode/schema.py
Log:
added note on missing message
Modified: FormEncode/trunk/formencode/schema.py
===================================================================
--- FormEncode/trunk/formencode/schema.py 2007-11-20 17:09:48 UTC (rev 3156)
+++ FormEncode/trunk/formencode/schema.py 2007-11-20 17:52:04 UTC (rev 3157)
@@ -28,6 +28,11 @@
class MySubSchema(MySchema):
name = None
+
+ Note that missing fields are handled at the Schema level. Missing
+ fields can have the 'missing' message set to specify the error
+ message, or if that does not exist the *schema* message
+ 'missingValue' is used.
"""
# These validators will be applied before this schema:
|
|
From: <sub...@co...> - 2007-10-21 03:43:13
|
Author: ianb
Date: 2007-10-20 21:43:12 -0600 (Sat, 20 Oct 2007)
New Revision: 3105
Modified:
FormEncode/trunk/docs/news.txt
FormEncode/trunk/formencode/validators.py
Log:
Added MACAddress and and CADR from Chrisopher Haas. Fixed strftime in DateValidator, which doesn't like unicode format strings. Fixed some docstrings which had become out of date
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2007-10-21 00:34:57 UTC (rev 3104)
+++ FormEncode/trunk/docs/news.txt 2007-10-21 03:43:12 UTC (rev 3105)
@@ -50,6 +50,9 @@
* Minor fix to setup.py to make FormEncode more friendly with
zc.buildout.
+* Added ``validators.CADR`` (for IP addresses with an optional range)
+ and ``validators.MACAddress`` (from Christoph Haas).
+
0.7.1
-----
Modified: FormEncode/trunk/formencode/validators.py
===================================================================
--- FormEncode/trunk/formencode/validators.py 2007-10-21 00:34:57 UTC (rev 3104)
+++ FormEncode/trunk/formencode/validators.py 2007-10-21 03:43:12 UTC (rev 3105)
@@ -818,14 +818,22 @@
}
def validate_python(self, value, state):
+ date_format = self.message('date_format', state)
+ if isinstance(date_format, unicode):
+ # strftime doesn't like unicode
+ encoding = 'utf8'
+ date_format = date_format.encode(encoding)
+ else:
+ encoding = None
if self.earliest_date:
if callable(self.earliest_date):
earliest_date = self.earliest_date()
else:
earliest_date = self.earliest_date
if value < earliest_date:
- date_formatted = earliest_date.strftime(
- self.message('date_format', state))
+ date_formatted = earliest_date.strftime(date_format)
+ if encoding:
+ date_formatted = date_formatted.decode(encoding)
raise Invalid(
self.message('after', state,
date=date_formatted),
@@ -836,8 +844,9 @@
else:
latest_date = self.latest_date
if value > latest_date:
- date_formatted = latest_date.strftime(
- self.message('date_format', state))
+ date_formatted = latest_date.strftime(date_format)
+ if encoding:
+ date_formatted = date_formatted.decode(encoding)
raise Invalid(
self.message('before', state,
date=date_formatted),
@@ -846,8 +855,9 @@
dt_mod = import_datetime(self.datetime_module)
now = datetime_now(dt_mod)
if value < now:
- date_formatted = now.strftime(
- self.message('date_format', state))
+ date_formatted = now.strftime(date_format)
+ if encoding:
+ date_formatted = date_formatted.decode(encoding)
raise Invalid(
self.message('future', state,
date=date_formatted),
@@ -860,8 +870,9 @@
value_as_date = datetime_makedate(
dt_mod, value.year, value.month, value.day)
if value_as_date < today:
- date_formatted = now.strftime(
- self.message('date_format', state))
+ date_formatted = now.strftime(date_format)
+ if encoding:
+ date_formatted = date_formatted.decode(encoding)
raise Invalid(
self.message('future', state,
date=date_formatted),
@@ -1090,7 +1101,7 @@
::
>>> UnicodeString().to_python(None)
- ''
+ u''
>>> UnicodeString().to_python([])
u''
>>> UnicodeString(encoding='utf-7').to_python('Ni Ni Ni')
@@ -1322,9 +1333,7 @@
>>> u.to_python('foo.com')
'http://foo.com'
>>> u.to_python('http://hahaha/bar.html')
- Traceback (most recent call last):
- ...
- Invalid: That is not a valid URL
+ 'http://hahaha/bar.html'
>>> u.to_python('https://test.com')
'https://test.com'
>>> u = URL(add_http=False, check_exists=True)
@@ -2181,6 +2190,9 @@
valueDict, state)
return field, v
+ def is_empty(self, value):
+ ## Empty dictionaries don't really apply here
+ return False
class StringBool(FancyValidator):
# Originally from TurboGears
@@ -2291,6 +2303,109 @@
chr(random.randrange(256))
for i in range(self.nonce_length)])
+class CIDR(FancyValidator):
+ """
+ Formencode validator to check whether a string is in correct CIDR
+ notation (IP address, or IP address plus /mask)
+
+ Examples::
+
+ >>> cidr = CIDR()
+ >>> cidr.to_python('127.0.0.1')
+ '127.0.0.1'
+ >>> cidr.to_python('299.0.0.1')
+ Traceback (most recent call last):
+ ...
+ Invalid: The octets must be within the range of 0-255 (not '299')
+ >>> cidr.to_python('192.168.0.1/1')
+ Traceback (most recent call last):
+ ...
+ Invalid: The network size (bits) must be within the range of 8-32 (not '1')
+ >>> cidr.to_python('asdf')
+ Traceback (most recent call last):
+ ...
+ Invalid: Please enter a valid IP address (a.b.c.d) or IP network (a.b.c.d/e)
+ """
+ messages = {
+ 'not_cidr_format' : u'Please enter a valid IP address (a.b.c.d) or IP network (a.b.c.d/e)',
+ 'illegal_octets' : u'The octets must be within the range of 0-255 (not %(octet)r)',
+ 'illegal_bits' : u'The network size (bits) must be within the range of 8-32 (not %(bits)r)',
+ }
+
+ def validate_python(self, value, state):
+ try:
+ # Split into octets and bits
+ if '/' in value: # a.b.c.d/e
+ addr, bits = value.split('/')
+ else: # a.b.c.d
+ addr, bits = value, 32
+
+ octets = addr.split('.')
+
+ # Only 4 octets?
+ if len(octets) != 4:
+ raise Invalid(self.message("not_cidr_format", state, value=value), value, state)
+
+ # Correct octets?
+ for octet in octets:
+ if int(octet) < 0 or int(octet) > 255:
+ raise Invalid(self.message("illegal_octets", state, octet=octet), value, state)
+
+ # Bits (netmask) correct?
+ if int(bits) < 8 or int(bits) > 32:
+ raise Invalid(self.message("illegal_bits", state, bits=bits), value, state)
+
+ # Splitting faild: wrong syntax
+ except ValueError:
+ raise Invalid(self.message("not_cidr_format", state), value, state)
+
+class MACAddress(FancyValidator):
+ """
+ Formencode validator to check whether a string is a correct hardware
+ (MAC) address.
+
+ Examples::
+
+ >>> mac = MacAddress()
+ >>> mac.to_python('aa:bb:cc:dd:ee:ff')
+ 'aabbccddeeff'
+ >>> mac.to_python('aa:bb:cc:dd:ee:ff:e')
+ Traceback (most recent call last):
+ ...
+ Invalid: A MAC address must contain 12 digits and A-F; the value you gave has 13 characters
+ >>> mac.to_python('aa:bb:cc:dd:ee:fx')
+ Traceback (most recent call last):
+ ...
+ Invalid: MAC addresses may only contain 0-9 and A-F (and optionally :), not 'x'
+ >>> MacAddress(add_colons=True).to_python('aabbccddeeff')
+ 'aa:bb:cc:dd:ee:ff'
+ """
+
+ strip=True
+ valid_characters = '0123456789abcdefABCDEF'
+ add_colons = False
+
+ messages = {
+ 'bad_length': _(u'A MAC address must contain 12 digits and A-F; the value you gave has %(length)s characters'),
+ 'bad_character': _(u'MAC addresses may only contain 0-9 and A-F (and optionally :), not %(char)r'),
+ }
+
+ def _to_python(self, value, state):
+ address = value.replace(':','') # remove colons
+ address = address.lower()
+ if len(address)!=12:
+ raise Invalid(self.message("bad_length", state, length=len(address)), address, state)
+ for char in address:
+ if char not in self.valid_characters:
+ raise Invalid(self.message("bad_character", state, char=char), address, state)
+ if self.add_colons:
+ address = '%s:%s:%s:%s:%s:%s' % (
+ address[0:2], address[2:4], address[4:6],
+ address[6:8], address[8:10], address[10:12])
+ return address
+
+ _from_python = _to_python
+
class FormValidator(FancyValidator):
"""
A FormValidator is something that can be chained with a
|
|
From: <sub...@co...> - 2007-10-21 00:34:57
|
Author: ianb
Date: 2007-10-20 18:34:57 -0600 (Sat, 20 Oct 2007)
New Revision: 3104
Modified:
FormEncode/trunk/docs/Design.txt
FormEncode/trunk/formencode/schema.py
FormEncode/trunk/tests/test_validators.py
Log:
tests from James Gardner; fix an issue where validating {} with a schema will always just return {}
Modified: FormEncode/trunk/docs/Design.txt
===================================================================
--- FormEncode/trunk/docs/Design.txt 2007-10-21 00:25:36 UTC (rev 3103)
+++ FormEncode/trunk/docs/Design.txt 2007-10-21 00:34:57 UTC (rev 3104)
@@ -95,7 +95,7 @@
secure way. The specific way we bridge this depends on the nature of
the user interface. An XML-RPC interface can make some assumptions
that a GUI cannot make. An HTML interface can typically make even
-less assumptions, including the basic integrity of the input data. It
+fewer assumptions, including the basic integrity of the input data. It
isn't reasonable that the object should know about all means of
inputs, and the varying UI requirements of those inputs; user
interfaces are volatile, and more art than science, but domain objects
Modified: FormEncode/trunk/formencode/schema.py
===================================================================
--- FormEncode/trunk/formencode/schema.py 2007-10-21 00:25:36 UTC (rev 3103)
+++ FormEncode/trunk/formencode/schema.py 2007-10-21 00:34:57 UTC (rev 3104)
@@ -306,6 +306,10 @@
result.extend(self.fields.values())
return result
+ def is_empty(self, value):
+ ## Generally nothing is empty for us
+ return False
+
def empty_value(self, value):
return {}
Modified: FormEncode/trunk/tests/test_validators.py
===================================================================
--- FormEncode/trunk/tests/test_validators.py 2007-10-21 00:25:36 UTC (rev 3103)
+++ FormEncode/trunk/tests/test_validators.py 2007-10-21 00:34:57 UTC (rev 3104)
@@ -1,4 +1,10 @@
from formencode.validators import String, UnicodeString, Invalid, Int
+from formencode.validators import DateConverter
+from formencode.variabledecode import NestedVariables
+from formencode.schema import Schema
+from formencode.foreach import ForEach
+import datetime
+from formencode.api import NoDefault
def validate(validator, value):
try:
@@ -80,5 +86,44 @@
assert validate(iv, "1") == messages('tooLow', None, min=5)
assert validate(iv, "15") == messages('tooHigh', None, max=10)
+def test_month_style():
+ date = DateConverter(month_style='dd/mm/yyy')
+ d = datetime.date(2007,12,20)
+ assert date.to_python('20/12/2007') == d
+ assert date.from_python(d) == '20/12/2007'
+def test_date():
+ date = DateConverter(month_style='dd/mm/yyy')
+ try:
+ date.to_python('20/12/150')
+ except Invalid, e:
+ assert 'Please enter a four-digit year after 1899' in str(e)
+
+def test_foreach_if_missing():
+
+ class SubSchema(Schema):
+ age = Int()
+ name = String(not_empty=True)
+
+ class MySchema(Schema):
+ pre_validators = [NestedVariables()]
+ people = ForEach(SubSchema(), if_missing=NoDefault, messages={'missing':'Please add a person'})
+
+ start_values = {}
+
+ class State:
+ pass
+
+ validator = MySchema()
+ assert validator.fields['people'].not_empty == False
+
+ state = State()
+
+ try:
+ values = validator.to_python(start_values, state)
+ except Invalid, e:
+ assert e.unpack_errors() == {'people': u'Please add a person'}
+ else:
+ raise Exception("Shouldn't be valid data", values, start_values)
+
|
|
From: <sub...@co...> - 2007-10-21 00:25:34
|
Author: ianb
Date: 2007-10-20 18:25:36 -0600 (Sat, 20 Oct 2007)
New Revision: 3103
Modified:
FormEncode/trunk/docs/news.txt
FormEncode/trunk/formencode/schema.py
Log:
Add missing message for missing fields
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2007-10-21 00:23:37 UTC (rev 3102)
+++ FormEncode/trunk/docs/news.txt 2007-10-21 00:25:36 UTC (rev 3103)
@@ -43,6 +43,10 @@
* Make ``validators.DateConverter`` serialize dates properly (from
James Gardner).
+* You can control the missing message (which by default is just
+ "Missing Value") using the message ``"missing"`` in a validator
+ (also from James Gardner).
+
* Minor fix to setup.py to make FormEncode more friendly with
zc.buildout.
Modified: FormEncode/trunk/formencode/schema.py
===================================================================
--- FormEncode/trunk/formencode/schema.py 2007-10-21 00:23:37 UTC (rev 3102)
+++ FormEncode/trunk/formencode/schema.py 2007-10-21 00:25:36 UTC (rev 3103)
@@ -159,9 +159,11 @@
if self.ignore_key_missing:
continue
if self.if_key_missing is NoDefault:
- errors[name] = Invalid(
- self.message('missingValue', state),
- None, state)
+ try:
+ message = validator.message('missing', state)
+ except KeyError:
+ message = self.message('missingValue', state)
+ errors[name] = Invalid(message, None, state)
else:
try:
new[name] = validator.to_python(self.if_key_missing, state)
|
|
From: <sub...@co...> - 2007-10-21 00:23:36
|
Author: ianb Date: 2007-10-20 18:23:37 -0600 (Sat, 20 Oct 2007) New Revision: 3102 Modified: FormEncode/trunk/docs/news.txt FormEncode/trunk/setup.py Log: Make use_setuptools optional in setup.py Modified: FormEncode/trunk/docs/news.txt =================================================================== --- FormEncode/trunk/docs/news.txt 2007-10-21 00:22:19 UTC (rev 3101) +++ FormEncode/trunk/docs/news.txt 2007-10-21 00:23:37 UTC (rev 3102) @@ -43,6 +43,9 @@ * Make ``validators.DateConverter`` serialize dates properly (from James Gardner). +* Minor fix to setup.py to make FormEncode more friendly with + zc.buildout. + 0.7.1 ----- Modified: FormEncode/trunk/setup.py =================================================================== --- FormEncode/trunk/setup.py 2007-10-21 00:22:19 UTC (rev 3101) +++ FormEncode/trunk/setup.py 2007-10-21 00:23:37 UTC (rev 3102) @@ -1,6 +1,9 @@ -from ez_setup import use_setuptools -use_setuptools() -from setuptools import setup +try: + from setuptools import setup +except ImportError: + from ez_setup import use_setuptools + use_setuptools() + from setuptools import setup version = '0.7.2' |