[albatross-users] Suggestion for pagesize, cols
Clint Miller
cmiller at tigerbyte.com
Fri Dec 6 13:41:59 EST 2002
Once I had my first albatross application working (in record time
thanks to your clear and precise tool) I had the user types try it
out and provide feedback. The first thing they wanted was a way to
control the number of rows and columns displayed on a per-user basis.
I cobbled together the following hack to tags.py to provide an
expr_pagesize in the <al-for> tag so that we didn't have to live with
an absolute value in pagesize:
--- albatross/tags.py Wed Sep 4 09:07:10 2002
+++ new-albatros/tags.py Thu Dec 5 20:18:06 2002
@@ -639,7 +639,7 @@
# be recreated if it already exists.
name = self.get_attrib('iter')
iter = None
- if self.has_attrib('pagesize') or
self.has_attrib('continue'):
+ if self.has_attrib('pagesize') or self.has_attrib('continue')
or self.has_attrib('expr_pagesize'):
iter = ctx.get_value(name)
if iter is None:
iter = ListIterator()
@@ -657,6 +657,11 @@
ctx.add_session_vars(name)
pagesize = int(self.get_attrib('pagesize'))
iter.set_pagesize(pagesize)
+ elif self.has_attrib('expr_pagesize'):
+ ctx.add_session_vars(name)
+ t_pagesize = self.get_attrib('expr_pagesize')
+ pagesize = ctx.eval_expr(t_pagesize)
+ iter.set_pagesize(pagesize)
# If CONTINUE if defined then the contents will flow on from
# the previous use of the iterator
if not self.has_attrib('continue'):
Now I can read the number of rows desired by the user from a table and
set it dynamically. There is something very similar for cols. Could
we provide this kind of functionality in the distribution? Is this
of interest to anyone?
- Clint Miller
More information about the Albatross-users
mailing list