Commit c1987820 authored by admuc's avatar admuc

avoid eval() - but still one exec() :-(

parent 74f569d8
......@@ -649,7 +649,31 @@ class A2X3(AttrDict):
file).
Executes the global function in an A2X3 class instance context.
'''
eval('to_%s(self)' % self.backend)
#eval('to_%s(self)' % self.backend) # avoid 'eval()'
if self.backend == 'docbook':
to_docbook(self)
elif self.backend == 'xhtml':
to_xhtml(self)
elif self.backend == 'manpage':
to_manpage(self)
elif self.backend == 'pdf':
to_pdf(self)
elif self.backend == 'dvi':
to_dvi(self)
elif self.backend == 'ps':
to_ps(self)
elif self.backend == 'tex':
to_tex(self)
elif self.backend == 'htmlhelp':
to_htmlhelp(self)
elif self.backend == 'chunked':
to_chunked(self)
elif self.backend == 'epub':
to_epub(self)
elif self.backend == 'text':
to_text(self)
else:
die('missing backend directive: %s' % self.backend)
def to_docbook(self):
'''
......@@ -970,7 +994,9 @@ if __name__ == '__main__':
opts.fop_opts = ' '.join(opts.fop_opts)
opts.xsltproc_opts = ' '.join(opts.xsltproc_opts)
opts.backend_opts = ' '.join(opts.backend_opts)
opts = eval(str(opts)) # Convert optparse.Values to dict.
# avoid 'eval()' found in v2
#opts = eval(str(opts)) # Convert optparse.Values to dict.
opts = vars(opts)
a2x3 = A2X3(opts)
OPTIONS = a2x3 # verbose and dry_run used by utility functions.
verbose('args: %r' % argv)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment