nothing with them, so it shouldn't allow them.
- Import ``sqlalchemy.orm`` as well as ``sqlalchemy``. User Sybiam reports an
+ - Add code to work with other iterable containers, contributed by Marcin
Auto-detect the kind of object and return a list/tuple
to access items from the collection.
See if the collection is a sequence
+ # f the collection is a sequence
if isinstance(obj, (list, tuple)):
+ # If object is iterable we can use it directly
+ if hasattr(obj, "__iter__") and hasattr(obj, "__len__"):
# Is SQLAlchemy 0.4 or better available? (0.3 is not supported - sorry)
if sqlalchemy_available[:3] != '0.3':
# Is the collection a query?
or isinstance(obj, sqlalchemy.sql.expression.Select):
return _SQLAlchemySelect(obj, sqlalchemy_session)
- raise TypeError("Sorry, your collection type is not supported by the paginate module. "
- "You can either provide a list, a tuple, an SQLAlchemy 0.4 select object or an "
- "SQLAlchemy 0.4 ORM-query object.")
+ raise TypeError("Sorry, your collection type is not supported by the "
+ "paginate module. You can provide a list, a tuple, a SQLAlchemy "
+ "select object or a SQLAlchemy ORM-query object.")