Questions tagged [colander]

Colander is a simple framework for validating, serializing and deserializing of data obtained via XML, JSON, an HTML form post or any other equally simple data structure.

The colander python package allows you to:

  • Define a schema declaratively (as a series of Python classes), or imperatively (with a series of function calls).
  • Deserialize a structure of simple types (sequences, mappings, numbers, strings) to produce objects conforming to your schema. The input is validated automatically.
  • Serialize objects conforming to the schema to a simple python structure, suitable for conversion to JSON, XML or HTML form data.

Colander is a good basis for form generation systems, data description systems, and configuration systems.

72 questions
0
votes
0 answers

Is it possible to use multiple forms with one submit button? I am using pyramid and deform

I have created 2 colander schemas as these reflect my database structure. I want to present both forms on one page with one submit button instead of two so that when submit is pressed it will validate and return errors for both forms at the same…
0
votes
1 answer

How to format dates in colander validator?

User Pyramid, Colander, and Deform, I've got a datetime widget. datetime_event = colander.SchemaNode( colander.DateTime(), validator=colander.Range( min=datetime( 2018, 1, 1, 0, 0, tzinfo=timezone.utc), …
Steve Piercy
  • 13,693
  • 1
  • 44
  • 57
0
votes
1 answer

Access attributes using dot operator for Objects created using colander model class

I want to know if there is a way to access the objects created using any Colander Model class using the dot operator. Example: class Image(colander.MappingSchema): url = colander.SchemaNode(colander.String()) width =…
timekeeper
  • 698
  • 15
  • 37
0
votes
1 answer

python colander not validate other fields?

I defined a class class Person(colander.MappingSchema): name = colander.SchemaNode(colander.String()) age = colander.SchemaNode(colander.Int() and I have a coming json string that may be like: { 'name': 'keith', 'age': '20', …
Justin Li
  • 1,035
  • 2
  • 12
  • 19
0
votes
1 answer

How do you validate application logic using Pyramid's Colander?

So far I am using colander to validate the data in my aiohttp application. The problem I face is that I don't know how to do "deep" validation. Given the following schema: import colander class User(colander.MappingSchema): username =…
amirouche
  • 7,682
  • 6
  • 40
  • 94
0
votes
1 answer

Pyramid with Deform not rendering properly. Rendered as pure string

I am trying out pyramid with deform. However the form is not rendered as form but a pure string @view_config(route_name='sign_up', renderer='templates/sign_up.jinja2') def sign_up(request): schema = SignUpForm().bind(request=request) button…
Bobby
  • 1,511
  • 1
  • 15
  • 24
0
votes
1 answer

Colander schemanode SelectWidget with "Select All" button

I just started working with the colander schemes; with the select multiple select Widget. How can I add a button "select all" that will select all options?
Joost Döbken
  • 3,450
  • 2
  • 35
  • 79
0
votes
1 answer

pyramid/cornice validators and colander schema

I have a cornice API with a view that has validators and a colander schema. I can't get access to colander validated data (request.validated) in my validator. I pass my data through colander. My colander schema looks something like this: from…
Graeme Stuart
  • 5,837
  • 2
  • 26
  • 46
0
votes
1 answer

Setting maximum upload size with deform.widget.FileUploadWidget

How one can limit maximum upload size with deform.widget.FileUploadWidget() so that the validation fails with a friendly error message if the file is too large?
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
0
votes
0 answers

deserialization 'infinity' date in colander

I'm using colander for deserialization and validation json data. I need process special values infinity and -infinity in date fields. But colander.Date doesn't support such value. class Card(colander.MappingSchema): card_no =…
Horned Owl
  • 139
  • 2
  • 9
0
votes
1 answer

Python Colander library is failing with exception 'createdon': u'Invalid date' when createdon field contains the value datetime.datetime.now()

I'm using python's colander library for validation. In my code there is a createdon field of colander.DateTime() type. When I'm providing it a value of datetime.datetime.now() it is failing with exception saying that createdon field has invalid…
anujkk
  • 1,333
  • 3
  • 14
  • 22
-1
votes
1 answer

Deserialize Multidict using Colander

On a website I have a If both options are selected, then the Pyramid server’s…
Jens
  • 8,423
  • 9
  • 58
  • 78
1 2 3 4
5