Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
Returns the first instance of `model` whose primary key has the value
`primary_key_value`, or ``None`` if no such instance exists.

If `primary_key` is specified, the column specified by that string is used
as the primary key column. Otherwise, the column named ``id`` is used.

        def get_by(session, model, primary_key_value, primary_key=None):
    """Returns the first instance of `model` whose primary key has the value
    `primary_key_value`, or ``None`` if no such instance exists.

    If `primary_key` is specified, the column specified by that string is used
    as the primary key column. Otherwise, the column named ``id`` is used.

    """
    result = query_by_primary_key(session, model, primary_key_value,
                                  primary_key)
    return result.first()
        


src/f/l/flask-restless-HEAD/tests/test_helpers.py   flask-restless(Download)
from flask.ext.restless.helpers import to_dict
from flask.ext.restless.helpers import upper_keys
from flask.ext.restless.helpers import get_by
from flask.ext.restless.helpers import is_like_list
 
        self.session.commit()
 
        person_test = get_by(self.session, self.Person, person1.id)
        assert person1 == person_test