I have a couple of questions about the select() function in tools.py
- what do the parameters: self, table, headers and **attr reference.
- how does this function produce joins on tables.
- what happens here:
if isinstance(table, str):
if not table in self.db.tables:
raise HTTP(404)
table = self.db[table]
- here:
if not attr.has_key('linkto'):
attr['linkto'] = URL(r=request, args='read')
- and here:
if not attr.has_key('upload'):
attr['upload'] = URL(r=request, f='download')
- why does the function return headers=headers and **attr untouched.
Best regards,
Annet.
def select(
self,
table,
query=None,
fields=None,
orderby=None,
limitby=None,
headers={},
**attr
):
request = self.environment.request
if isinstance(table, str):
if not table in self.db.tables:
raise HTTP(404)
table = self.db[table]
if not query:
query = table.id > 0
if not fields:
fields = [table.ALL]
rows=self.db(query).select(*fields, **dict(orderby=orderby,
limitby=limitby))
if not rows:
return None # Nicer than an empty table.
if not attr.has_key('linkto'):
attr['linkto'] = URL(r=request, args='read')
if not attr.has_key('upload'):
attr['upload'] = URL(r=request, f='download')
return SQLTABLE(rows, headers=headers, **attr)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---