Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Changes between Version 7 and Version 8 of Search_Pagination


Ignore:
Timestamp:
03/23/06 02:14:09 (13 years ago)
Author:
fredlin
Comment:

Improve Performance section

Legend:

Unmodified
Added
Removed
Modified
  • Search_Pagination

    v7 v8  
    168168 
    169169These changes will improve readability and maintenability of your code. 
     170 
     171= Improve Performance = 
     172After every thing works, you may want to take a cup of coffee and have confidence to paly some "refactor" trick to improve the performance and clearity. 
     173 
     174We intutivily saw that we do too much "coding" stuff on "pagesearch.kid" to present "${params}", we may draw those code back to controller.py to clean the template.  
     175 
     176We could return only what we expect to present on template, thus we should do more process and return more keys in dict. It's a bit harder to understand than the previous code. 
     177 
     178{{{ 
     179@expose(html=".templates.welcome") 
     180def index(self, start = 0): 
     181    a = TableEntry.select(TableEntry.q.fieldA == True, orderBy='fieldB') 
     182    offset = 20 
     183    start = int(start)*10 
     184    return dict(context = a[start:(start+offset)], start = start, offset = offset, query_size = a.count(), expense = get_expense(a)) 
     185}}} 
     186 
     187Then you can remove the <?python ...?> section in "pagesearch.kid", becausse those params are already returned by "controller.py".