On Friday, March 18, 2016 at 1:18:23 PM UTC-7, [email protected] wrote:
>
> Maybe something about "args=request.args(2,5)"?
>
>
He's trying to do a slice, but that would be [2:5], innit?

 

> You could try to test this:
>
> args=[request.args(2),request.args(5)]
>
>
>
shouldn't those '(' and ')' be '[' and ']'  (list indexes)?

Also, (Jeff) please verify which part of the URL is request.args[0] .  It 
will be after the app/contoller/function code (and you're using routes.py 
to set default for the c/f part?);
I see "sheet" where I count 4, but it should be double-checked.

/dps


>
>
> On Friday, March 18, 2016 at 1:01:51 PM UTC-7, Jeff Riley wrote:
>>
>> Hello All,
>>
>> I am pulling my hair out.  I am trying to redirect the view button on a 
>> smartgrid.  I can get the button to redirect to the view I want, but I 
>> cannot parse the URL correctly to get the correct sheet id.
>>
>> Here is my controller
>>
>> @auth.requires_membership('manager')
>> def manage_customers():
>>     if 'new' in request.args:
>>         if request.args(2) == 'customer':
>>             redirect(URL('new_customer'))
>>         elif request.args(4) == 'sheet':
>>             redirect(URL('new_sheet', args=request.args(2)))
>>     if 'edit' in request.args:
>>         if request.args(4) == 'sheet':
>>             redirect(URL('edit_sheet', args=request.args(2)))
>>     if 'view' in request.args:
>>         if request.args(4) == 'sheet':
>>             redirect(URL('view_sheet', args=request.args(2,5)))
>>         elif request.args(6) == 'sheet_archive':
>>             redirect(URL('view_sheet', args=request.args(7)))
>>     form = SQLFORM.smartgrid(db.customer, linked_tables=['address', 
>> 'sheet', 'sheet_archive'],
>>                              searchable= dict(customer=True, 
>> address=False, sheet=False),
>>                              editable= dict(customer=True, address=True, 
>> sheet=True, sheet_archive=False),
>>                              deletable= dict(customer=True, address=True, 
>> sheet=True, sheet_archive=False),
>>                              create=dict(customer=True, address=True, 
>> sheet=True, sheet_archive=False),
>>                              paginate=20, maxtextlength=60, 
>> fields=[db.customer.first_name,
>>                              db.customer.last_name, db.customer.phone, 
>> db.customer.email, db.customer.handed,
>>                              db.address.address1, db.address.address2, 
>> db.address.city, db.address.state_province,
>>                              db.address.postal_code, db.sheet.title, 
>> db.sheet.created_by, db.sheet.created_on,
>>                              db.sheet_archive.id, 
>> db.sheet_archive.title, db.sheet_archive.created_by,
>>                              db.sheet_archive.created_on],)
>>     return dict(form=form, request=request)
>>
>> Here is my URL:
>>
>>
>> http://127.0.0.1:8000/manage_customers/customer/sheet.customer_id/1/edit/sheet/2?_signature=3b4a45778f06aec42421ef503cba968cd633269a
>>
>>
>> I can only get the customer_id and not the sheet #2.  So I am always 
>> displaying the first customer record and the first sheet record.  SO LOST.
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to