stefanofontanelli/ColanderAlchemy — pull request #62 by pieterproigia (2014-09-09 10:04:45+00:00)
Title: Allow setting ColanderAlchemy options in sqlalchemy type

This allows for an extra location for customization of the schema inside a `column.type`. It looks for the `__colanderalchemy_config__` attribute in the type for customization. This allows for:

```Python
import colander
from sqlalchemy import Column, Integer, Unicode
from sqlalchemy.type import TypeDecorator
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

class Email(TypeDecorator):
impl = Unicode
__colanderalchemy_config__ = {'validator': colander.Email}

class User(Base):
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
email = Column(Email, nullable=False)
second_email = Column(Email)

schema = SQLAlchemySchemaNode(User)

```
Being equal to the following colander schema:
```Python
import colander

class User(colander.MappingSchema):
id = colander.SchemaNode(colander.Integer(),
missing=colander.drop)
email = colander.SchemaNode(colander.String(),
validator=colander.Email())
second_email = colander.SchemaNode(colander.String(),
validator=colander.Email(),
missing=colander.drop)
```

Where both email columns will be validated with `colander.Email`, but `email` will have missing required and `second_email` missing drop in the colander schema.