Line Ending Woes in .js files when using Athena
Werner Thie <[email protected]> Wed, 06 Jun 2007 10:01:35 +0200
| Newsgroups | gmane.comp.python.quotient.dev |
|---|---|
| Message-ID | <[email protected]> |
Hi all
Just spent a few extra hours debugging a problem which manifested itself
as a well running code on MSW and same code throwing on **IX.
The problem was eventually tracked back to having its source in the
regexp used for extracting the imported modules out of the .js file when
using statements of the form
// import Nevow.Athena
If those files are stored with a MSW/DOS line endings (0x0d, 0x0a), the
regexp
_importExpression = re.compile('^// import (.+)$', re.MULTILINE)
in line 175 of athena.py delivers back an additional '\r' at the end of
the isolated 'Nevow.Athena', thus preventing the lookup of the module in
the CachedFile.load() function in util.py which throws a KeyError in
this case.
The short solution is to save .js files with **IX line endings (0x0a)
exclusively.
I am not that fluent in speaking regexps; is somebody out there
listening, which knows how to massage the regexp or would the solution
be doing a
strip(r'\r')
on the generated keys.
Thxs, Werner