clevercss/clevercss — Issue #15: function 'fail' is not defined when missing macro detected
Author: atulbh
Created: 2012-01-28 08:51:01+00:00
State: open

An undefined variable placed on a line by itself gets (correctly) considered to be an unknown macro with clevercss attempting to raise an exception fail('No macros with name "%s" is defined' % v), however 'fail' itself is undefined in the context of the recurse function in engine.py causing an unhandled exception such as:

Traceback (most recent call last):
File "../git/clevercss/bin/ccss", line 140, in
main()
File "../git/clevercss/bin/ccss", line 51, in main
convert_many(args, options)
File "../git/clevercss/bin/ccss", line 126, in convert_many
converted = clevercss.convert(src.read(), fname=fname)
File "/home/atul/proj/web/git/clevercss/clevercss/__init__.py", line 29, in convert
return engine.Engine(source, fname=fname).to_css(context)
File "/home/atul/proj/web/git/clevercss/clevercss/engine.py", line 30, in __init__
self.rules, self._vars, self._imports = parser.parse(source)
File "/home/atul/proj/web/git/clevercss/clevercss/engine.py", line 387, in parse
handle_rule(i_r, i_c, i_d, macroses)
File "/home/atul/proj/web/git/clevercss/clevercss/engine.py", line 349, in handle_rule
recurse(macroses)
File "/home/atul/proj/web/git/clevercss/clevercss/engine.py", line 326, in recurse
fail('No macros with name "%s" is defined' % v)
NameError: global name 'fail' is not defined