Skip to content

Allow SQLAlchemySchemaNode subclassing#104

Open
arnaud-morvan wants to merge 1 commit into
stefanofontanelli:masterfrom
arnaud-morvan:subclassing
Open

Allow SQLAlchemySchemaNode subclassing#104
arnaud-morvan wants to merge 1 commit into
stefanofontanelli:masterfrom
arnaud-morvan:subclassing

Conversation

@arnaud-morvan
Copy link
Copy Markdown

As we want relationship's nodes ceated with the same type as parent node.

Here is an example of subclassing:

import colander
from colanderalchemy import SQLAlchemySchemaNode


@colander.deferred
def deferred_request(node, kw):
    return kw.get('request')


@colander.deferred
def deferred_dbsession(node, kw):
    return kw.get('dbsession')


class GeoFormSchemaNode(SQLAlchemySchemaNode):

    def __init__(self, *args, **kw):
        super().__init__(*args, **kw)
        self.request = deferred_request
        self.dbsession = deferred_dbsession

As we want relationship's nodes ceated with the same type as parent node.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant