Skip to content

@malthe /pickle.py secret

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
def get_instance(cls, args):
inst = cls.query.get_raw(args)
if inst is None:
raise ValueError(
"Query for type '%s' returned no items for "
"primary key: (%s)." % (
cls.__name__,
", ".join(map(repr, args))
))
return inst
def get_instance_query(inst):
return (
get_instance,
(type(inst), tuple(getattr(inst, name) for name in (
column.name for column in inst.__mapper__.primary_key
))))
Model.__reduce__ = get_instance_query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.