On Wednesday, February 11, 2015 at 8:48:17 AM UTC-8, Richard wrote:
>
> Seeing the whole controller and view may help... You can also try just
> your redirection that fail in a new controller function to see if it works
> or not... Just a simple redirect not the in your controller but if it could
> be using the same url parameter... For instance pass the id instead of
> getting id from env...
>
> Some times web2py lies on where the issue come from... From the code you
> show us, I can't see any str and http object concatenation...
>
> Richard
>
I didn't either, but learned from the book that redirect() is a wrapper for
raise HTTP(303,
'You are being redirected <a href="%s">here</a>' % location,
Location='http://www.web2py.com')
<URL:http://web2py.com/books/default/chapter/29/04/the-core?search=redirect#HTTP-and-redirect>
It might be interesting to unwrap and see if the same issue occurs.
(I have some experience in trying to concatenate strings and other stuff,
so while I might not be experienced with redirect() I am experienced with
tickets ;-} )
/dps
> On Tue, Feb 10, 2015 at 6:32 PM, Maggs <[email protected] <javascript:>
> > wrote:
>
>> Hey all,
>>
>> I recently set up a new dev environment with a new version of web2py
>> (2.9.11). In production I am currently running version 1.99.7. When I
>> imported my 1.99.7 apps into version 2.9.11 I had to clean up a few issues,
>> but this one I'm unable to figure out. I have a simple page that updates an
>> object based on form input. Everything seems to be working just fine and
>> the object is being updated, however the redirect is producing this error:
>> <type 'exceptions.TypeError'> cannot concatenate 'str' and 'HTTP' objects
>> Versionweb2py™Version 2.9.11-stable+timestamp.2014.09.15.23.35.11
>> Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>>
>> Traceback (most recent call last):
>> File "/var/web2py/gluon/restricted.py", line 224, in restricted
>> exec ccode in environment
>> File "/var/web2py/applications/configgui/views/environment/edit.html",
>> line 74, in <module>
>> File "/var/web2py/gluon/languages.py", line 416, in __len__
>> return len(str(self))
>> File "/var/web2py/gluon/languages.py", line 379, in __str__
>> self.T.translate(self.m, self.s))
>> File "/var/web2py/gluon/languages.py", line 923, in translate
>> lambda: self.get_t(message))
>> File "/var/web2py/gluon/languages.py", line 141, in get_from_cache
>> result = lang_dict.setdefault(val, fun())
>> File "/var/web2py/gluon/languages.py", line 923, in <lambda>
>> lambda: self.get_t(message))
>> File "/var/web2py/gluon/languages.py", line 795, in get_t
>> key = prefix + message
>> TypeError: cannot concatenate 'str' and 'HTTP' objects
>>
>>
>> So the page is super simple and looks like this:
>> env['name'] = request.vars.name.strip()
>> env['category_id']=request.vars.category
>> env['description']=request.vars.description
>> env.update()
>> logger.write(request.url, env, 'Updated Environment', env['name'],
>> session.username)
>> url = URL(c='environment', f='details', args=[env['id']])
>> redirect(url)
>> This is after the form.accepts criteria. I have put print statements
>> after every line to try to pinpoint where the error was being produced and
>> everything seems to be running successfully except for the redirect. Any
>> ideas why this is happening? I looked up redirect in the documentation
>> thinking perhaps something has changed in the redirect functionality in the
>> new version of web2py, but haven't seen anything that would explain this.
>>
>> Thanks,
>> M
>>
>> --
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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.