Questions tagged [genshi]

Genshi is a Python library that provides an integrated set of components for parsing, generating, and processing HTML, XML or other textual content for output generation on the web.

Genshi is a Python library that provides an integrated set of components for parsing, generating, and processing HTML, XML or other textual content for output generation on the web.

Genshi is being developed by Edgewall Software, the team best known for Trac.

77 questions
15
votes
2 answers

Why is __init__ not called after __new__ SOMETIMES

Let me start with this is not a repeat of Why does __init__ not get called if __new__ called with no args. I have tried to carefully construct some sample code for __new__ and __init__ that has no explanation I can find. The basic…
Phil Cooper
  • 5,747
  • 1
  • 25
  • 41
10
votes
5 answers

Insert javascript at top of including file in Jinja 2

In Jinja2, I would like the following to work as it looks like it should, by running: from jinja2 import Environment, FileSystemLoader env = Environment(loader=FileSystemLoader('.')) template = env.get_template('x.html') print…
Brian M. Hunt
  • 81,008
  • 74
  • 230
  • 343
7
votes
1 answer

Genshi: if/else

How do I do a simple if/else in the Genshi templating language? I've found this ticket, which seems to suggest that Genshi doesn't support if/else, but it doesn't really explain what it supports instead. I basically just want something like this: …
AP257
  • 89,519
  • 86
  • 202
  • 261
7
votes
5 answers

Should I use Mako for Templating?

I've been considering a templating solution, although my choices are between Mako and Genshi. I find templating in Genshi a bit ugly, so I'm shifting more towards Mako. I've gone to wonder: what is so good about the fact that Mako allows embedded…
Pyornide
6
votes
3 answers

Check if variable exists in tmpl_context (Python, Pylons, Genshi)?

I am trying to figure out how to check if a variable exists in the template context 'tmpl_context' using Pylons and Python. What I am trying to do is: I've got a Pylons layout template. This should contain a message section if, and only if, the…
Fynn
  • 4,753
  • 3
  • 32
  • 69
5
votes
2 answers

How do I use genshi.builder to programmatically build an HTML document?

I recently discovered the genshi.builder module. It reminds me of Divmod Nevow's Stan module. How would one use genshi.builder.tag to build an HTML document with a particular doctype? Or is this even a good thing to do? If not, what is the right…
Jeremy Cantrell
  • 26,392
  • 13
  • 55
  • 78
4
votes
1 answer

Genshi nested match templates

Ho do I make Genshi parse the output of a match template? In other words: I've got a template like this in Genshi: Something ${select('@label')}
${select('*')} Something else
When used…
Marcin
  • 591
  • 5
  • 12
4
votes
2 answers

Genshi: TemplateSyntaxError: not well-formed (invalid token) with ampersands in