Using python script in plone page

If I write some python scripts in zope how can I include it in the plone page.

For eg:
I want to create my own map with folium and written an python script with ZMI. How to add that to my plone page?

The correct way for including your own code in Plone is to write proper filesystem-based code as a browser view. Using ZMI-side scripting and templating is neither supported nor encouraged. ....or look into

https://training.plone.org/5/ttw/rapido.html

...but stay away from the ZMI for scripting.

-aj

As said: yo want to make browser view. https://docs.plone.org/develop/plone/views/browserviews.html

About the maps: what are you trying to make ?

1 Like

just a map to add marker to the location that the user enters

Make it a browser view or check for existing map addons.
As said: no coding in the ZMI...never ever.

1 Like

thanks dude

Someone already made this (collective.geo), and it can also be done with path-leaflet

If you add plone.pattetrnslib / collective.geolocationbehavior / plone.formwidget.geolocation and a view

Probably not put the logic in template.pt, but it could be done something like this:

<div class="geolocation_wrapper">
         <div class="pat-leaflet map" data-geojson='{
           "type": "FeatureCollection",
           "features": [
                {
               "type": "Feature",
               "id": 1,
               "properties": {
                 "popup": "<h4>${context/Title}</h4><p>Latitude: ${context/geolocation/latitude}<br/>Longitude: ${context/geolocation/longitude}</p>"
               },
               "geometry": {
                   "type": "Point",
                   "coordinates": [
                       ${context/geolocation/longitude},
                       ${context/geolocation/latitude}
                   ]
               }
          }
        ]}' data-pat-leaflet='{
           "fullscreencontrol": true,
           "locatecontrol": true,
           "zoomcontrol": true,
           "minimap": true,
           "geosearch": true,
           "geosearch_provider": "google",
           "addmarker": false
         }'>
        </div>
    </div>

thank you