Personal tools
You are here: Home Members chrism software buildit_issues InFileWriter doesn't properly resolve namespaces
Issue 7 of buildit_issues [BUILDIT]
Title: InFileWriter doesn't properly resolve namespaces
Status: Pending Security related: No
Description: It doesn't seem that InFileWriter (by design or accident) correctly interpolates variables in namespaces: --- infilewriterbug.py --- # framework hair...
From: Jeff Hammel on: Jul 25, 07 20:51
Anonymous User Last update: Jul 27, 07 15:16
Topic/class: Zope/bug Importance: critical
Version info: 1.0
Issue 7 Transcript
3 entries
= Comment - Entry #3 by Anonymous User on Jul 27, 2007 3:16 pm

Probably a better regex:

hugger = re.compile(r'<<([\w\.-]+(?:/[\w\.-]+)?)>>')

________________________________________
= Comment - Entry #2 by Anonymous User on Jul 25, 2007 9:57 pm

This can be 'fixed' with the following:

hugger = re.compile(r'<<([\w\.-]+)>>')

This can be changed to:

hugger = re.compile(r'<<([\w\./-]+)>>')



________________________________________
= Request - Entry #1 by Anonymous User on Jul 25, 2007 8:51 pm

It doesn't seem that InFileWriter (by design or accident) correctly interpolates variables in namespaces:

--- infilewriterbug.py ---
# framework hair
from buildit.context import Context
from buildit.context import Software
from buildit.task import Task
from buildit.commandlib import InFileWriter

success = Task('write a file',
               commands=[InFileWriter(infile='filetobewritten2.txt',
                                      outfile='success.out')],
               )

failure = Task('write another file [this one fails]',
               commands=[InFileWriter(infile='filetobewritten.txt',
                                      outfile='failure.out')],
               )

context = Context('infilewriterbug.ini')

breakfast = Software(success, context)
breakfast.install()
print context.interpolate('${foo}', None)

dinner = Software(failure, context)
dinner.install()

print context.interpolate('${baz/flarg}', None)

--- infilewriterbug.ini ---
[globals]
foo = bar

[namespaces]
baz = ${buildoutdir}/fleem.ini [1.0]

--- fleem.ini ---
[1.0]
flarg = testvariable

--- filetobewritten.txt ---
Hi, i would like to say <<baz/flarg>>

--- filetobewritten2.txt ---
Hi, i would like to say <<foo>>

--- success.out ---
Hi, i would like to say bar

--- failure.out ---
Hi, i would like to say <<baz/flarg>>

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: