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

  • SEARCH
  • Home
  • 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 310197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:48:41+00:00 2026-05-12T07:48:41+00:00

Is there a simple way of escaping the magic characters used for variable substitution

  • 0

Is there a simple way of escaping the magic characters used for variable substitution in a buildout configuration, such that the string is left alone. In other words, where I say:

[part]
attribute = ${variable}

I don’t actually want it to expand ${variable} but leave it as the literal value.

In practice the specific problem I am encountering is not in the buildout configuration file itself, but in a template file processed by the recipe ‘collective.recipe.template’. This uses the same variable substitution engine from buildout that is used in the configuration files. Problem is that the file I want to use as a template already uses ‘${variable}’ syntax for its own purposes in conjunction with the application configuration system which ultimately consumes the file.

The only way I have found to get around the problem is to use something like:

[server-xml]
recipe = collective.recipe.template
input = templates/server.xml.in
output = ${product:build-directory}/conf/server.xml
dollar = $

In the template input file then have:

${dollar}{variable}

instead of:

${variable}

that it already had.

What this is doing is cause a lookup of ‘dollar’ attribute against the section using the template and replace it with ‘$’.

Rather than have to do that, was sort of hoping that one could do:

\${variable}

or perhaps even:

$${variable}

and eliminate the need to have to have a dummy attribute to trick it into doing what I want.

Looking at the source code for buildout, the way it matches variable substitution doesn’t seem to provide an escape mechanism.

If there is indeed no way, then perhaps someone knows of an alternate templating recipe for buildout that can do variable expansion, but provides an escape mechanism for whatever way it indicates variables, such that one can avoid problems where there may be a clash between the templating systems expansion mechanism and literal data in the file being templated.

  • 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-12T07:48:41+00:00Added an answer on May 12, 2026 at 7:48 am

    I am afraid your analysis of the buildout variable substitution code (which collective.recipe.template relies on) is correct. There is no syntax for escaping a ${section:variable} variable substitution and your solution of providing a ${dollar} substitution is the best workaround I can think of.

    You could of course also propose a patch to the zc.buildout team to add support for escaping the variable substitution syntax. 🙂

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

Sidebar

Related Questions

is there a simple way to remove the extra spaces in a string? ie
Is there a simple way to encrypt/decrypt a string with a key? Something like:
is there a simple way to just output each record in a select statement
Is there a simple way to expose, say, NSString or UIColor properties of a
Is there any simple way to create search for Google App Engine for specific
is there a simple way of creating a button collection from the existing buttons
is there a simple way to create a command-line tool in Objective C? I'd
I set up a variable in the shell: -bash-3.00$ echo $source_repl source ../setup_simple.tcl I
I want to allow users of my site to post urls. These urls would
When using git add with a file pattern it only adds recursively the untracked

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.