| 1 |
Prepare proper documentation and examples for GitHub/readthedocs |
| 2 |
|
| 3 |
Prepare a method that can be overriden for extension modules like paginate-sqlalchemy |
| 4 |
(e.g. get_wrapper) |
| 5 |
|
| 6 |
Move SQLAlchemy code into a separate module paginate-sqlalchemy and subclass paginate.Page() for that purpose. |
| 7 |
|
| 8 |
Upload to PyPi |
| 9 |
|
| 10 |
Announce to pylons-discussion mailing list. |
| 11 |
|
| 12 |
Add AJAX tutorial |
| 13 |
|
| 14 |
onclick (optional) |
| 15 |
This paramter is a string containing optional Javascript code |
| 16 |
that will be used as the 'onclick' action of each pager link. |
| 17 |
It can be used to enhance your pager with AJAX actions loading another |
| 18 |
page into a DOM object. |
| 19 |
|
| 20 |
In this string the variable '$partial_url' will be replaced by |
| 21 |
the URL linking to the desired page with an added 'partial=1' |
| 22 |
parameter (or whatever you set 'partial_param' to). |
| 23 |
In addition the '$page' variable gets replaced by the |
| 24 |
respective page number. |
| 25 |
|
| 26 |
Note that the URL to the destination page contains a 'partial_param' |
| 27 |
parameter so that you can distinguish between AJAX requests (just |
| 28 |
refreshing the paginated area of your page) and full requests (loading |
| 29 |
the whole new page). |
| 30 |
|
| 31 |
[Backward compatibility: you can use '%s' instead of '$partial_url'] |
| 32 |
|
| 33 |
jQuery example: |
| 34 |
"$('#my-page-area').load('$partial_url'); return false;" |
| 35 |
|
| 36 |
Yahoo UI example: |
| 37 |
"YAHOO.util.Connect.asyncRequest('GET','$partial_url',{ |
| 38 |
success:function(o){YAHOO.util.Dom.get('#my-page-area').innerHTML=o.responseText;} |
| 39 |
},null); return false;" |
| 40 |
|
| 41 |
scriptaculous example: |
| 42 |
"new Ajax.Updater('#my-page-area', '$partial_url', |
| 43 |
{asynchronous:true, evalScripts:true}); return false;" |
| 44 |
|
| 45 |
ExtJS example: |
| 46 |
"Ext.get('#my-page-area').load({url:'$partial_url'}); return false;" |
| 47 |
|
| 48 |
Custom example: |
| 49 |
"my_load_page($page)" |
| 50 |
|
| 51 |
p.pager(url="/index.php?page=$page", link_attr=dict(onclick="$('target').load('/ding/dong?page=$page'")) |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
Write SQLAlchemy tests |
| 56 |
|
| 57 |
Create test with setup/teardown code for paginate.sqlalchemy.SqlalchemyPage (e.g. sqlite) |
| 58 |
|
| 59 |
#class TestSQLAlchemyCollectionTypes(unittest.TestCase): |
| 60 |
# def setUp(self): |
| 61 |
# try: |
| 62 |
# import sqlalchemy as sa |
| 63 |
# import sqlalchemy.orm as orm |
| 64 |
# except ImportError: |
| 65 |
# raise SkipTest() |
| 66 |
# self.engine = engine = sa.create_engine("sqlite://") # Memory database |
| 67 |
# self.sessionmaker = orm.sessionmaker(bind=engine) |
| 68 |
# self.metadata = metadata = sa.MetaData(bind=engine) |
| 69 |
# self.notes = notes = sa.Table("Notes", metadata, |
| 70 |
# sa.Column("id", sa.Integer, primary_key=True)) |
| 71 |
# class Note(object): |
| 72 |
# pass |
| 73 |
# self.Note = Note |
| 74 |
# notes.create() |
| 75 |
# orm.mapper(Note, notes) |
| 76 |
# insert = notes.insert() |
| 77 |
# records = [{"id": x} for x in range(1, 101)] |
| 78 |
# engine.execute(insert, records) |
| 79 |
# |
| 80 |
# def tearDown(self): |
| 81 |
# import sqlalchemy as sa |
| 82 |
# import sqlalchemy.orm as orm |
| 83 |
# orm.clear_mappers() |
| 84 |
# self.notes.drop() |
| 85 |
# |
| 86 |
# def test_sqlalchemy_orm(self): |
| 87 |
# session = self.sessionmaker() |
| 88 |
# q = session.query(self.Note).order_by(self.Note.id) |
| 89 |
# page = paginate.Page(q) |
| 90 |
# records = list(page) |
| 91 |
# eq_(records[0].id, 1) |
| 92 |
# eq_(records[-1].id, 20) |
| 93 |
|
| 94 |
add support for CouchDB databases (http://guide.couchdb.org/editions/1/de/recipes.html) |
| 95 |
careful: CouchDB is stupid and has very limited and weird behavior when it comes to choosing a certain page of data |