Thank you for fixing this bug so quickly!

Patch is applied to output_formats.py, geomap seems to work as expected, server is not throwing any errors at least :)

Erik:
I took some notes when applying this patch, this may guide you in applying the patch.
# My comments
$ Command
- Output of command.

# Locate file to apply patch

$ dpkg-query -L nav | grep output_formats.py

- /usr/share/pyshared/nav/web/geomap/output_formats.py      # Apply the patch on this one as the other is symlinked here.
- /usr/lib/python2.7/dist-packages/nav/web/geomap/output_formats.py # Symlinked

$ wget https://github.com/UNINETT/nav/commit/88451ed79dc5043e572c2543ee1249cb1befc800.diff

# Dry-run patching just in case of typo :)
$ patch --dry-run /usr/share/pyshared/nav/web/geomap/output_formats.py < 88451ed79dc5043e572c2543ee1249cb1befc800.diff

# Ok, no errors, applying patch as root.

$ sudo patch /usr/share/pyshared/nav/web/geomap/output_formats.py < 88451ed79dc5043e572c2543ee1249cb1befc800.diff
- patching file /usr/share/pyshared/nav/web/geomap/output_formats.py

# File patched, but geomap still throws an error. Maybe some files are cached...

$ sudo service nav restart && sudo service apache2 restart

# Geomap works! Not sure if it was restarting nav or apache2 that did the trick.


2017-08-23 15:42 GMT+02:00 Erik Kemper <kempere@quakerchem.com>:

Thanks, very fast response!

But.... how do I implement this when I did an apt-get install?

Cheers
Erik


-----Original Message-----
From: nav-users-request@uninett.no [mailto:nav-users-request@uninett.no] On Behalf Of John Magne Bredal
Sent: 23 August 2017 13:42
To: Espen Lorentzen <esplor@gmail.com>; nav-users@uninett.no
Subject: Re: Fresh install - Geomap error

On 23. aug. 2017 08:45, John Magne Bredal wrote:
> On 22. aug. 2017 09:30, Espen Lorentzen wrote:
>> I recently did a fresh install of nav on Debian Jessie.
>>
>> Everything is working except geomap, when navigating to
>> http://nav-server/geomap/normal/ i receive an alert via mail with the
>> following information:
>
> I have reproduced this and filed this as an issue -
> https://github.com/UNINETT/nav/issues/1565
>

This issue now has a fix:

https://github.com/UNINETT/nav/commit/88451ed79dc5043e572c2543ee1249cb1befc800

A patch for this can be downloaded from
https://github.com/UNINETT/nav/commit/88451ed79dc5043e572c2543ee1249cb1befc800.diff

>
>
>
>>
>> Internal Server Error: /geomap/normal/data Traceback (most recent call
>> last):
>>
>>   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py",
>> line 111, in get_response
>>
>>     response = wrapped_callback(request, *callback_args, **callback_kwargs)
>>
>>   File "/usr/lib/python2.7/dist-packages/nav/web/geomap/views.py", line
>> 163, in data
>>
>>     do_fetch_data)
>>
>>   File "/usr/lib/python2.7/dist-packages/nav/web/geomap/views.py", line
>> 210, in get_formatted_data
>>
>>     output = format_data(format_, features)
>>
>>   File
>> "/usr/lib/python2.7/dist-packages/nav/web/geomap/output_formats.py",
>> line 96, in format_data
>>
>>     return formatter(featurelist)
>>
>>   File
>> "/usr/lib/python2.7/dist-packages/nav/web/geomap/output_formats.py",
>> line 45, in make_geojson
>>
>>     return json.dumps(geojson)
>>
>>   File "/usr/lib/python2.7/json/__init__.py", line 243, in dumps
>>
>>     return _default_encoder.encode(obj)
>>
>>   File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
>>
>>     chunks = self.iterencode(o, _one_shot=True)
>>
>>   File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
>>
>>     return _iterencode(o, 0)
>>
>>   File "/usr/lib/python2.7/json/encoder.py", line 184, in default
>>
>>     raise TypeError(repr(o) + " is not JSON serializable")
>>
>> TypeError: <lazy_dict {'color': '#666666', 'popup': {'content': u'<div
>> class="place-popup">\n\n  <table class="listtable">\n    <tr>\n
>> <th>Rooms</th>\n      <th>IP devices</th>\n      <th>CPU load
>> (max)</th>\n    </tr>\n    <tr>\n      <td>1</td>\n
>> <td>1</td>\n      <td>unknown</td>\n    </tr>\n  </table>\n\n  \n
>> <table class="listtable">\n      <caption>\n        <a
>> href="/search/room/MEKU-2ETG-EF-02/"\n
>> target="_blank"\n           title="View room information">\n
>> MEKU-2ETG-EF-02\n          (Etasjefordeling #2 - MEKU)\n
>> </a>\n      </caption>\n\n      <tr>\n        <td><b>IP Devices:</b>
>> 1</td>\n        <td><b>CPU load (max):</b> unknown</td>\n
>> </tr>\n\n      <tr>\n        <td colspan="2">\n          <ul
>> class="large-block-grid-2">\n            \n
>> <li>\n                <h5>\n                  <a
>> href="/ipdevinfo/sw-meku-03.net.domain.no/
>> <http://sw-meku-03.net.domain.no/>"\n
>> target="_blank"\n                     title="View in IP Device
>> Info">sw-meku-03.net.domain.no
>> <http://sw-meku-03.net.domain.no></a>\n
>> </h5>\n                <ul class="no-bullet">\n
>> <li><b>IP:</b>10.10.10.10</li>\n                  <li><b>Category:</b>
>> SW</li>\n                  <li><b>Type:</b> Cisco
>> C2960S</li>\n                  <li><b>Up:</b> y</li>\n
>> <li><b>Load:</b> unknown</li>\n                </ul>\n
>> </li>\n            \n          </ul>\n        </td>\n      </tr>\n\n
>> </table>\n  \n\n</div>\n', 'closable': True, 'id': 'popup-cn[cn[37]]',
>> 'size': [300, 250]}, 'type': 'node', 'size': 4}> is not JSON serializable
>>
>> I guess there's a step i forgot, but can't figure out what it is.
>>
>> --
>> MVH / REGARDS:
>>
>> Espen Lorentzen
>> esplor@gmail.com <mailto:esplor@gmail.com>
>
>


--
John Magne Bredal
john.m.bredal@uninett.no
+4791897366

Abels gt. 5- Teknobyen NO-7465 Trondheim




QUAKER CHEMICAL CORPORATION DISCLAIMER:
This message is intended only for the use of the individual or entity to which it is directed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by reply e-mail and delete the message and any attachments.




--
MVH / REGARDS:

Espen Lorentzen
esplor@gmail.com