Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5844253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:15:58+00:00 2026-05-22T12:15:58+00:00

I am using mako templates in pyramid which uses the ${} construct for variable

  • 0

I am using mako templates in pyramid which uses the ${} construct for variable substitution. I also use an Openlayers script to show a map with features. I want to style my features with Stylemap like so:

var symbolizer = OpenLayers.Util.applyDefaults(
    {externalGraphic: "images/${thumbnail}.png", pointRadius: 20},
    OpenLayers.Feature.Vector.style["default"]);
var styleMap = new OpenLayers.StyleMap({"default": symbolizer, "select": {pointRadius: 30}});
var vectorLayer = new OpenLayers.Layer.Vector("thumbs", {styleMap: styleMap});
...
vectorLayer.features[0].attributes.thumbnail="sight";
vectorLayer.features[1].attributes.thumbnail="bar";

See also The OpenLayers Styles Framework.

The problem I have is that mako interprets the Openlayers ${} variable as its own variable and I get a “NameError: Undefined” from the server. I have searched a while but could not find a solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:15:59+00:00Added an answer on May 22, 2026 at 12:15 pm

    As far as I remember, you can use a double dollar sign to escape it:

    "images/$${thumbnail}.png"
    

    HTH,

    EDIT: Huh, seems I was wrong, see https://groups.google.com/forum/#!topic/mako-discuss/g00Qq3_FNgg

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to use url_for inside of a mako template with pyramid (using
Our Django site is built using Mako templates. We want to use a third
I'm using Pylons with Mako templates and I want to avoid typing this all
I'm using CherryPy, Mako templates, and SQLAlchemy in a web app. I'm coming from
I'm using mako templates to generate specialized config files. Some of these files contain
I frequently encounter this error in Mako templates using Pylons 0.9.7: AttributeError: 'NoneType' object
I plan to use wsgi + mako in Windows. I install mako using C:\wsgi>c:\Python26\Scripts\easy_install.exe
Im curious as to why this happens. Im using Mako templates to iterate over
I want to use Mako templates with GAE instead of Django templates. I found
I periodically get this problem where all of a sudden mako is using old

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.