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