Skip to content

Instantly share code, notes, and snippets.

@mhluongo
Created December 28, 2012 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhluongo/4399621 to your computer and use it in GitHub Desktop.
Save mhluongo/4399621 to your computer and use it in GitHub Desktop.
A pymaps extension that exposes maps globally in Javascript.
from pymaps import PyMap
class MyPyMap(PyMap):
#old-style classes, unfortunately
def _mapjs(self, map):
super_js = PyMap._mapjs(self, map)
return super_js + 'PyMaps.push(%s);\n' % map.id
def _buildmaps(self):
super_js = PyMap._buildmaps(self)
return "PyMaps = [];" + super_js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment