"Lord Galrion" <[EMAIL PROTECTED]> writes:
> my classmates want to see their names as a header above the datagrid
> by passing there names from a URL ( I hope this makes sense )
>
> I read the docs, and know I can create a method like,
>
> @expose()
> def names(self, first='somebody', 'nobody'):
> return 'Student: %s %s' % (first, last)
You CAN'T create it. It's a syntax error in Python:
>>> def names(self, first='somebody', 'nobody'):
File "<stdin>", line 1
def names(self, first='somebody', 'nobody'):
^
SyntaxError: invalid syntax
>>>
> which either the URL ../first/last or via ?first=first&last=last will
> work but I don't know how to combine both the datafrid widget method
> and the names method to display together. I am totally lost.
You return the parameter(s) you got to the model as well and there you do
something like:
${first} ${last}
${your_datagrid.display(your_data)}
> I am feeling very lame here because what I want to do is
>
> return 'Student: %s %s' % (first, last), dict(projects=projects,
> projwidget=projwidget)
What you want is:
return dict(student=(first, last), projects=projects, projwidget=projwidget)
or to use what I put above in the model:
return dict(first=first, last=last, projects=projects, projwidget=projwidget)
> I know this is not correct to do cause I get errors, but I don't
> understand it and what is the python syntax. Which is where my
> confusion is. I don't know if I need to put the first last names in a
> dictionary, or somehow combine the methods.
You don't need. But the exposed method should return just one thing and it
should be a dictionary, a list or a string.
--
Jorge Godoy <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---