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 8434833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:45:57+00:00 2026-06-10T06:45:57+00:00

I have the following scenario: We are using web2py in the server side We

  • 0

I have the following scenario:

  1. We are using web2py in the server side
  2. We are serving some ember.js pages
  3. Currently those ember.js pages are inside an iframe, because ember.js and web2py conflict with template {{ }} marks. That means we can not easily mix web2py templates and ember.js templates.
  4. So I have implemented the helper class solution: class em(DIV)
  5. Now I want to process the original ember-tagged html files, and produce the em-tagged files, integrating ember.js and web2py templating-systems into a cohesive unit.

For that I need to change all instances of {{XXX}} in the ember.js files to {{=em(‘XXX’)}}, including instances which span over several lines. I am thinking of going regex here, but I would like to avoid reinventing the wheel (and having to handle strange corner-cases)

Can you think of a generic method in python of parsing these kind of templates. It is simply a matter of looking for start and end delimiter ({{ and }}), and putting an =em('XXX'), handling newlines, and keeping the format (that is, keep the newlines if there are some).

Note: this is actually not ember.js specific; it could apply to any multi-line delimiter-based templating system.

  • 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-06-10T06:45:58+00:00Added an answer on June 10, 2026 at 6:45 am

    Note, in the trunk version of web2py (which will be released as web2py 2.0 in the next few days), you can now specify custom delimiters for the templates — so you can change the web2py delimiters so they no longer conflict with the ember.js delimiters. For example, in a model file:

    response.delimiters = ['{%', '%}']
    

    Then in your web2py templates, you can do:

    {%=P('hello world')%}
    <p>{{ember template code}}</p>
    {%=P('{{ember template code generated by web2py}}')%}
    

    which will produce:

    <p>hello world</p>
    <p>{{ember template code}}</p>
    <p>{{ember template code generated by web2py}}</p>
    

    Note, response.delimiters is set on each request, so if you don’t want to change the web2py delimiters on all pages but only those that include ember code, you can set response.delimiters conditionally (either by setting it in the specific actions that need it, or by checking the requested controller and/or function in a model file). For example, in a model file:

    if request.function in ['action1', 'action2', 'action3']:
        response.delimiters = ['{%', '%}']
    

    or in a controller:

    def action1():
        response.delimiters = ['{%', '%}']
        [etc.]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Scenario: Three different Sharepoint Server: sp1.company.com; sp2.company.com... Internal Users using
I am trying to understand isolation/locks in SQL Server. I have following scenario in
I have the following scenario (using rich faces): ... <a4j:outputPanel id=foo> <h:commandButton disabled=#{not _user.selected}
I am using Python and have to work on following scenario using Hadoop Streaming:
You have the following scenario: //Two threads, using shared data shared data = 2
I have the following scenario: I am parsing a JSON Response from a server
We have the following scenario using the .NET RabbitMQ library: A worker thread picks
I have the following scenario, using mvc3: I have a database table which holds
I am using NHibernate with fluent mapping. I have the following scenario: public class
I have the following scenario: Server: Jetty (with configured JAAS) Client: Jersey invoked via

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.