#5837 Fix c (tmpl_context) and g (app_globals) imports

v1.0.0
closed
General
Cory Johns
2015-08-20
2013-02-18
Cory Johns
No

The tmpl_context and app_globals objects are no longer referenced as c and g in pylons (and haven't been for some time), but a lot of our code still tries to import them as such. We have some code that imports them correctly and then monkey patches c and g as aliases in pylons, but it doesn't always work when running tests.

The imports should be cleaned up and changed to:

from pylons import tmpl_context as c
from pylons import app_globals as g

The bad imports can be found with:

ack 'from pylons import ([cg]|c, *g|g, *c)$'

Discussion

  • Dave Brondsema

    Dave Brondsema - 2013-02-19
    • status: open --> in-progress
    • assigned_to: Dave Brondsema
    • size: --> 1
    • milestone: forge-backlog --> forge-feb-22
     
  • Dave Brondsema

    Dave Brondsema - 2013-02-19
    # one-line changes, with some variations
    ag 'from pylons import c, g$' -l | xargs sed -i 's/from pylons import c, g/from pylons import tmpl_context as c, app_globals as g/'
    # multi-line changes, with some variations
    ag 'from pylons import c, g, ' -l | xargs sed -i 's/from pylons import c, g, /from pylons import tmpl_context as c, app_globals as g\nfrom pylons import /'
    
     
  • Dave Brondsema

    Dave Brondsema - 2013-02-19
    • status: in-progress --> code-review
     
  • Dave Brondsema

    Dave Brondsema - 2013-02-19

    {allura,forge-classic,sftheme,forgehg,forgepastebin}:db/5837

    I've run the full test suite and done basic tests of running stuff via web, paster and taskd. Code review might be onerous even with -U0 but spot-check it at least. Look for places I might've missed and spot-check functionality too.

    ForgeHg changes are after the [#5685] changes, so we need to get those merged in Allura before this is merged.

     

    Related

    Tickets: #5685

  • Cory Johns - 2013-02-19
    • qa: Cory Johns
     
  • Cory Johns - 2013-02-20
    • status: code-review --> closed
     

Log in to post a comment.