moumoutte/sqla_helpers — pull request #4 by mpesche (2014-03-21 08:37:39+00:00)
Title: Missing classmethod

Pylint raises an error when we build get, filter, count or all request.

Ex:

bin/pylint test_pylint.py
E: 33 0: No value passed for parameter 'cls' in function call (no-value-for-parameter)

"""
Pylint
"""
from sqla_helpers.base_model import BaseModel

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.types import Integer, Unicode

maker = sessionmaker()

DeclarativeBase = declarative_base()
metadata = DeclarativeBase.metadata

class People(DeclarativeBase, BaseModel):
""" People table
"""

__tablename__ = 'people'
__table_args__ = {'useexisting': True}

id_personne = Column(Integer, autoincrement=True, primary_key=True)
name = Column(Unicode(40), nullable=False)

def __init__(self, name):
self.name = name

engine = create_engine('sqlite://')
session = sessionmaker(bind=engine)()
BaseModel.register_sessionmaker(session, force=True)
metadata.create_all(engine)

People.all()