Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #578 (closed task: fixed)

Opened 12 years ago

Last modified 10 years ago

Not output tg_flash when tg_format==json and tg_flash is None

Reported by: ep@… Owned by: anonymous
Priority: normal Milestone: 1.0b1
Component: TurboGears Version:
Severity: minor Keywords:
Cc:

Description

In controllers.py tg_flash is ALWAYS added to the output. It would be nice not to add tg_flash to the output when:

  tg_format == 'json' and tg_flash is None

Use-Case for this is using TG for a RPC server using JSON as the marshalling format. The extra tg_flash dict entry doesn't hurt, but it also doesn't add anything.

Change History

comment:1 Changed 12 years ago by elvelind

  • Milestone set to 0.9

comment:2 Changed 11 years ago by elvelind

  • Milestone changed from 0.9 to 1.0b1

If so we should only add tg_flash to the output dict if it's not None.

comment:3 Changed 11 years ago by elvelind

  • Status changed from new to closed
  • Resolution set to fixed

fixed in 1540,1541

comment:4 Changed 11 years ago by godoy

  • Status changed from closed to reopened
  • Resolution fixed deleted

Unfortunately, this breaks old applications.

I believe that in a feature freeze condition this is not desirable.

Here's the backtrace:

Page handler: <bound method Permissoes.index of <neobh.controllers.usuarios.permissoes.Permissoes object at 0xb709c66c>>
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 105, in _run
    self.main()
  File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 254, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in index
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/turbogears/controllers.py", line 323, in expose
    output = database.run_with_transaction(
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/turbogears/database.py", line 221, in run_with_transaction
    retval = func(*args, **kw)
  File "<string>", line 5, in _expose
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/turbogears/controllers.py", line 340, in <lambda>
    mapping, fragment, *args, **kw)))
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/turbogears/controllers.py", line 374, in _execute_func
    return _process_output(output, template, format, content_type, mapping, fragment)
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/turbogears/controllers.py", line 67, in _process_output
    fragment=fragment)
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/turbogears/view/base.py", line 129, in render
    return engine.render(**kw)
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/plugins/kid/turbokid/kidsupport.py", line 156, in render
    return t.serialize(encoding=self.defaultencoding, output=format, fragment=fragment)
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/kid/kid/__init__.py", line 236, in serialize
    return serializer.serialize(self, encoding, fragment)
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/kid/kid/serialization.py", line 51, in serialize
    text = list(self.generate(stream, encoding, fragment))
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/kid/kid/serialization.py", line 327, in generate
    for ev, item in self.apply_filters(stream):
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/kid/kid/serialization.py", line 84, in balancing_filter
    for ev, item in stream:
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/kid/kid/pull.py", line 206, in _coalesce
    for ev, item in stream:
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/kid/kid/filter.py", line 21, in transform_filter
    for ev, item in apply_matches(stream, template, templates, apply_func):
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/kid/kid/filter.py", line 39, in apply_matches
    template, templates[:i] + templates[i+1:], apply_func):
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/kid/kid/filter.py", line 31, in apply_matches
    item = stream.expand()
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/kid/kid/pull.py", line 95, in expand
    for ev, item in self._iter:
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/kid/kid/pull.py", line 164, in _track
    for p in stream:
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/kid/kid/pull.py", line 206, in _coalesce
    for ev, item in stream:
  File "/home/godoy/empresa/clientes/bhquality/NeoBH/Neo-BH/neobh/templates/master.py", line 234, in _match_func
  File "/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/kid/kid/template_util.py", line 145, in update_dict
    raise exc_type("%s in %s" % (exc_obj, code))
NameError: name 'tg_flash' is not defined in value=tg_flash or ''

comment:5 Changed 11 years ago by elvelind

  • Status changed from reopened to closed
  • Resolution set to fixed

reverted in 1.0 but still in trunk.

comment:6 Changed 11 years ago by elvelind

now you can set tg.no_empty_flash in the 0.9 branch to omit it if it's None

Note: See TracTickets for help on using tickets.