On 10/29/06, Lord Galrion <[EMAIL PROTECTED]> wrote:
> @expose()
> def names(self, first='somebody', 'nobody'):
>     return 'Student: %s %s' % (first, last)

The argument syntax here is wrong. The self is fine, the first= is
fine, but the 'nobody' needs an argument name (last=).

You'll want to define a method:

@expose()
def names(self, first='default_firstname',last='default_lastname'):
    return 'Student: %s %s' % (first, last)

Which you can pass values to (only) via
?first=custom_first&last=custom_last. Alternatively,
you can define the method:

@expose
def names(self, *name):
    first = 'default_firstname'
    last = 'default_lastname'
    if len(name) >= 2:
        first = name[0]
        last = name[1]
    elif len(name) == 1:
        first = name[0]
    return 'Student: %s %s' % (first, last)

Which you can pass values to via /names/custom_first/custom_last

> I am feeling very lame here because what I want to do is
>
> return 'Student: %s %s' % (first, last), dict(projects=projects,
> projwidget=projwidget)

return dict(name='Student: %s %s' %(first,last),
                projects=projects, projwidget=projwidget)

or if you want the individual name parts:

return dict(first=first,last=last,projects=projects,projwidget=projwidget)

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to