From d2ed7edee5991a795597a4d8e14a7bcf84113748 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 4 Dec 2011 16:36:31 -0500 Subject: dont try so hard --- pyramid/config/util.py | 10 +++------- pyramid/interfaces.py | 14 +++++++++----- pyramid/tests/test_config/test_util.py | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pyramid/config/util.py b/pyramid/config/util.py index b65e44725..81c5d8176 100644 --- a/pyramid/config/util.py +++ b/pyramid/config/util.py @@ -28,18 +28,14 @@ class ActionInfo(object): def __init__(self, file, line, function, src): line = line or 0 src = src or '' - ssrc = src.strip() - column = src.rfind(ssrc) - eline = line + len(src.split('\n')) - ecolumn = len(src.split('\n')[-1]) srclines = src.split('\n') src = '\n'.join(' %s' % x for x in srclines) self._src = src self.file = file self.line = line - self.column = column - self.eline = eline - self.ecolumn = ecolumn + self.column = None + self.eline = None + self.ecolumn = None self.function = function def __str__(self): diff --git a/pyramid/interfaces.py b/pyramid/interfaces.py index 2c096cf40..c656c3510 100644 --- a/pyramid/interfaces.py +++ b/pyramid/interfaces.py @@ -1004,15 +1004,19 @@ class IActionInfo(Interface): """ Class which provides code introspection capability associated with an action. The ParserInfo class used by ZCML implements the same interface.""" file = Attribute( - 'filename of action-invoking code as a string') + 'Filename of action-invoking code as a string') line = Attribute( - 'starting line number in file (as an integer) of action-invoking code') + 'Starting line number in file (as an integer) of action-invoking code.' + 'This will be ``None`` if the value could not be determined.') column = Attribute( - 'start column number in file (as an integer) of action-invoking code') + 'Starting column number in file (as an integer) of action-invoking ' + 'code. This will be ``None`` if the value could not be determined.') eline = Attribute( - 'ending line number in file (as an integer) of action-invoking code') + 'Ending line number in file (as an integer) of action-invoking code.' + 'This will be ``None`` if the value could not be determined.') ecolumn = Attribute( - 'ending column number in file (as an integer) of action-invoking code') + 'Ending column number in file (as an integer) of action-invoking code.' + 'This will be ``None`` if the value could not be determined.') def __str__(): """ Return a representation of the action information (including diff --git a/pyramid/tests/test_config/test_util.py b/pyramid/tests/test_config/test_util.py index 31aa7f77a..12d3055d0 100644 --- a/pyramid/tests/test_config/test_util.py +++ b/pyramid/tests/test_config/test_util.py @@ -333,9 +333,9 @@ class TestActionInfo(unittest.TestCase): def test_ctor(self): inst = self._makeOne('filename', 10, 'function', ' linerepr\n\nfoo') self.assertEqual(inst.line, 10) - self.assertEqual(inst.column, 2) - self.assertEqual(inst.eline, 13) - self.assertEqual(inst.ecolumn, 3) + self.assertEqual(inst.column, None) + self.assertEqual(inst.eline, None) + self.assertEqual(inst.ecolumn, None) def test___str__(self): inst = self._makeOne('filename', 0, 'function', ' linerepr ') -- cgit v1.2.3