I meant "upgrade": upgrade my application's code

On 01/15/2016 07:15 PM, Alessandro Molina wrote:


On Fri, Jan 15, 2016 at 2:48 PM, Tamas Hegedus <[email protected]
<mailto:[email protected]>> wrote:

    Hi,

    I am trying to upgrade TG 2.3.4 to 2.3.7
    I ran into (at least) two problems below I can not solve.
    Could you also point out what I could check to solve similar problems?

    -------------------------
    1. Now in my root controller the session seems to be None:

    class RootController(BaseController):
         secc  = SecureController()
         error = ErrorController()
         madmin    = AdminController()
         myprofile  = MyProfile()

         session['role'] = ''
         session.save()

         @expose('mutdb23.templates.index')
         def index(self) etc...

    File "/home/hegedus/tg23/mutdb23/mutdb23/controllers/root.py", line
    79, in RootController session['role'] = ''
    File
    "/home/hegedus/tg23/lib/python2.7/site-packages/tg/support/objectproxy.py",
    line 31, in __setitem__ self._current_obj()[key] = value
    TypeError: 'NoneType' object does not support item assignment


This should be covered by:

http://turbogears.readthedocs.org/en/latest/cookbook/upgrading.html#session-and-cache-middlewares-replaced-by-application-wrappers

You are problably missing the session.enabled = True option in app_cfg.py

    -------------------------
    2. Although the docs of "url()" says the same in the two versions:

    redirect(url('/login', came_from=came_from, __logins=login_counter))
    TypeError: url() got an unexpected keyword argument 'came_from'


Passing arguments directly to tg.url was deprecated since TG2.1 but got
removed in 2.2, it's odd that you have been able to use it so far.
see
http://turbogears.readthedocs.org/en/latest/cookbook/upgrading.html#deprecations-now-removed

You should now be passing params=dict() argumt to url.

Also pay attention that redirect+url is actually broken, you would be
applying the SCRIPT_NAME twice, the tg.redirect function supports params
argument directly
http://turbogears.readthedocs.org/en/latest/reference/classes.html#tg.controllers.util.redirect


--
You received this message because you are subscribed to the Google
Groups "TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to