Profile value not JSON serializable on grid

Bug #1391134 reported by Paul Everitt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KARL4
Fix Released
High
Chris Rossi
4.4
Fix Committed
Undecided
Unassigned

Bug Description

TypeError: <karl.models.profile.Profile object u'mulvik' at 0xa0b9612c> is not JSON serializable
Exception when processing https://karl.soros.org/people/osi/c1/r1/budapest-office/jquery_grid?body=Open+Society+Justice+Initiative&_=1415615131391&limit=12&start=12&sortColumn=name&sortDirection=asc
Referer: https://karl.soros.org/people/osi/c1/r1/budapest-office/?body=Open+Society+Justice+Initiative

Traceback (most recent call last):
  File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/tweens.py", line 17, in excview_tween
    response = handler(request)
  File "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 107, in tm_tween
    return response
  File "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 75, in __exit__
    return self._retry_or_raise(t, v, tb)
  File "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 60, in _retry_or_raise
    reraise(t, v, tb) # otherwise reraise the exception
  File "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 100, in tm_tween
    response = handler(request)
  File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/router.py", line 153, in handle_request
    response = view_callable(context, request)
  File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/config/views.py", line 186, in _secured_view
    return view(context, request)
  File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/config/views.py", line 311, in rendered_view
    context)
  File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py", line 393, in render_view
    return self.render_to_response(response, system, request=request)
  File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py", line 422, in render_to_response
    result = self.render(value, system_values, request=request)
  File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py", line 418, in render
    result = renderer(value, system_values)
  File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py", line 143, in _render
    return json.dumps(value)
  File "/usr/lib/python2.6/json/__init__.py", line 230, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python2.6/json/encoder.py", line 367, in encode
    chunks = list(self.iterencode(o))
  File "/usr/lib/python2.6/json/encoder.py", line 309, in _iterencode
    for chunk in self._iterencode_dict(o, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 275, in _iterencode_dict
    for chunk in self._iterencode(value, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 309, in _iterencode
    for chunk in self._iterencode_dict(o, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 275, in _iterencode_dict
    for chunk in self._iterencode(value, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 306, in _iterencode
    for chunk in self._iterencode_list(o, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 204, in _iterencode_list
    for chunk in self._iterencode(value, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 317, in _iterencode
    for chunk in self._iterencode_default(o, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 323, in _iterencode_default
    newobj = self.default(o)
  File "/usr/lib/python2.6/json/encoder.py", line 344, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <karl.models.profile.Profile object u'mulvik' at 0xa0b9612c> is not JSON serializ

Revision history for this message
Paul Everitt (paul-agendaless) wrote :

Hi Balazs. I think we might need jump in on this one quickly. The profile u'apamirbek' also says it isn't serializable.

Changed in karl4:
assignee: Balazs Ree (ree) → Chris Rossi (chris-archimedeanco)
Revision history for this message
Paul Everitt (paul-agendaless) wrote :

Actually, changing this to Chris, as it is view code side. However, Balazs, if you think you can fix it, I would appreciate it.

Revision history for this message
Paul Everitt (paul-agendaless) wrote :

Most likely fix will be to find the GSA data that is causing the problem and ask Nat to edit.

Revision history for this message
Paul Everitt (paul-agendaless) wrote :
Download full text (3.6 KiB)

I suspect these are related...I just got a value error:

ValueError: limit must be 1 or greater
Exception when processing https://karl.soros.org/people/foundations/c1/tifa-foundation-indonesia/jquery_grid?_=1415622202911&limit=12&start=-48&sortColumn=name&sortDirection=asc
Referer: https://karl.soros.org/people/foundations/c1/tifa-foundation-indonesia/

Traceback (most recent call last):
  File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/tweens.py", line 17, in excview_tween
    response = handler(request)
  File "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 107, in tm_tween
    return response
  File "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 75, in __exit__
    return self._retry_or_raise(t, v, tb)
  File "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 60, in _retry_or_raise
    reraise(t, v, tb) # otherwise reraise the exception
  File "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 100, in tm_tween
    response = handler(request)
  File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/router.py", line 153, in handle_request
    response = view_callable(context, request)
  File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/config/views.py", line 186, in _secured_view
    return view(context, request)
  File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/config/views.py", line 292, in rendered_view
    result = view(context, request)
  File "/srv/osfkarl/production/59/eggs/karl-4.3-py2.6.egg/karl/views/peopledirectory.py", line 395, in jquery_grid_view
    reverse=reverse,
  File "/srv/osfkarl/production/59/eggs/karl-4.3-py2.6.egg/karl/views/peopledirectory.py", line 537, in get_grid_data
    **kw
  File "/srv/osfkarl/production/59/eggs/karl-4.3-py2.6.egg/karl/views/batch.py", line 137, in get_catalog_batch_grid
    batch = get_catalog_batch(context, request, **kw)
  File "/srv/osfkarl/production/59/eggs/karl-4.3-py2.6.egg/karl/views/batch.py", line 57, in get_catalog_batch
    numdocs, docids, resolver = searcher(**kw)
  File "/srv/osfkarl/production/59/eggs/karl-4.3-py2.6.egg/karl/models/adapters.py", line 77, in __call__
    num, docids = self.catalog.search(**kw)
  File "/srv/osfkarl/production/59/eggs/perfmetrics-2.0-py2.6.egg/perfmetrics/__init__.py", line 222, in call_with_mod
    return f(*args, **kw)
  File "/srv/osfkarl/production/59/eggs/perfmetrics-2.0-py2.6.egg/perfmetrics/__init__.py", line 151, in call_with_metric
    return f(*args, **kw)
  File "/srv/osfkarl/production/59/eggs/karl-4.3-py2.6.egg/karl/models/catalog.py", line 101, in search
    num, docids = self._search(*arg, **kw)
  File "/srv/osfkarl/production/59/eggs/perfmetrics-2.0-py2.6.egg/perfmetrics/__init__.py", line 151, in call_with_metric
    return f(*args, **kw)
  File "/srv/osfkarl/production/59/eggs/karl-4.3-py2.6.egg/karl/models/catalog.py", line 122, in _search
    res = super(CachingCatalog, self).search(*arg, **kw)
  File "/srv/osfkarl/production/59/eggs/repoze.catalog-0.8.3-py2.6.egg/repoze/catalog/catalog.py", line...

Read more...

Revision history for this message
Paul Everitt (paul-agendaless) wrote :

And now getting more profiles with that JSON error.

information type: Private → Private Security
information type: Private Security → Public
Changed in karl4:
status: New → In Progress
Revision history for this message
Chris Rossi (chris-archimedeanco) wrote :

Just pushed something for this to master.

Revision history for this message
Paul Everitt (paul-agendaless) wrote : Re: [Bug 1391134] Re: Profile value not JSON serializable on grid
Download full text (4.5 KiB)

Ok, I’ll queue up a release on staging and put into production tonight. Is it ok if I also do the connection stats or is that too risky?

—Paul

> On Nov 10, 2014, at 2:26 PM, Chris Rossi <email address hidden> wrote:
>
> Just pushed something for this to master.
>
> ** Changed in: karl4/4.4
> Status: New => Fix Committed
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1391134
>
> Title:
> Profile value not JSON serializable on grid
>
> Status in OSF KARL4:
> In Progress
> Status in KARL4 4.4 series:
> Fix Committed
>
> Bug description:
> TypeError: <karl.models.profile.Profile object u'mulvik' at 0xa0b9612c> is not JSON serializable
> Exception when processing https://karl.soros.org/people/osi/c1/r1/budapest-office/jquery_grid?body=Open+Society+Justice+Initiative&_=1415615131391&limit=12&start=12&sortColumn=name&sortDirection=asc
> Referer: https://karl.soros.org/people/osi/c1/r1/budapest-office/?body=Open+Society+Justice+Initiative
>
> Traceback (most recent call last):
> File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/tweens.py", line 17, in excview_tween
> response = handler(request)
> File "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 107, in tm_tween
> return response
> File "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 75, in __exit__
> return self._retry_or_raise(t, v, tb)
> File "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 60, in _retry_or_raise
> reraise(t, v, tb) # otherwise reraise the exception
> File "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 100, in tm_tween
> response = handler(request)
> File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/router.py", line 153, in handle_request
> response = view_callable(context, request)
> File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/config/views.py", line 186, in _secured_view
> return view(context, request)
> File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/config/views.py", line 311, in rendered_view
> context)
> File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py", line 393, in render_view
> return self.render_to_response(response, system, request=request)
> File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py", line 422, in render_to_response
> result = self.render(value, system_values, request=request)
> File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py", line 418, in render
> result = renderer(value, system_values)
> File "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py", line 143, in _render
> return json.dumps(value)
> File "/usr/lib/python2.6/json/__init__.py", line 230, in dumps
> return _default_encoder.encode(obj)
> File "/usr/lib/python2.6/json/encoder.py", line 367, in encode
> chunks = list(...

Read more...

Revision history for this message
Chris Rossi (chris-archimedeanco) wrote :
Download full text (9.0 KiB)

I don't think it's too risky.

On Mon, Nov 10, 2014 at 2:38 PM, Paul Everitt <email address hidden> wrote:

> Ok, I’ll queue up a release on staging and put into production tonight. Is
> it ok if I also do the connection stats or is that too risky?
>
> —Paul
>
> > On Nov 10, 2014, at 2:26 PM, Chris Rossi <email address hidden>
> wrote:
> >
> > Just pushed something for this to master.
> >
> > ** Changed in: karl4/4.4
> > Status: New => Fix Committed
> >
> > --
> > You received this bug notification because you are subscribed to the bug
> > report.
> > https://bugs.launchpad.net/bugs/1391134
> >
> > Title:
> > Profile value not JSON serializable on grid
> >
> > Status in OSF KARL4:
> > In Progress
> > Status in KARL4 4.4 series:
> > Fix Committed
> >
> > Bug description:
> > TypeError: <karl.models.profile.Profile object u'mulvik' at 0xa0b9612c>
> is not JSON serializable
> > Exception when processing
> https://karl.soros.org/people/osi/c1/r1/budapest-office/jquery_grid?body=Open+Society+Justice+Initiative&_=1415615131391&limit=12&start=12&sortColumn=name&sortDirection=asc
> > Referer:
> https://karl.soros.org/people/osi/c1/r1/budapest-office/?body=Open+Society+Justice+Initiative
> >
> > Traceback (most recent call last):
> > File
> "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/tweens.py",
> line 17, in excview_tween
> > response = handler(request)
> > File
> "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py",
> line 107, in tm_tween
> > return response
> > File
> "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py",
> line 75, in __exit__
> > return self._retry_or_raise(t, v, tb)
> > File
> "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py",
> line 60, in _retry_or_raise
> > reraise(t, v, tb) # otherwise reraise the exception
> > File
> "/srv/osfkarl/production/59/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py",
> line 100, in tm_tween
> > response = handler(request)
> > File
> "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/router.py",
> line 153, in handle_request
> > response = view_callable(context, request)
> > File
> "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/config/views.py",
> line 186, in _secured_view
> > return view(context, request)
> > File
> "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/config/views.py",
> line 311, in rendered_view
> > context)
> > File
> "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py",
> line 393, in render_view
> > return self.render_to_response(response, system, request=request)
> > File
> "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py",
> line 422, in render_to_response
> > result = self.render(value, system_values, request=request)
> > File
> "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py",
> line 418, in render
> > result = renderer(value, system_values)
> > File
> "/srv/osfkarl/production/59/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers....

Read more...

Changed in karl4:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.