summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-12-04 16:36:31 -0500
committerChris McDonough <chrism@plope.com>2011-12-04 16:36:31 -0500
commitd2ed7edee5991a795597a4d8e14a7bcf84113748 (patch)
treec2f70acb7673aa7c6bea37f91e5612a3816bc2e0
parent549cf70449226539bd5b5db48fce3a6095c26cd9 (diff)
downloadpyramid-d2ed7edee5991a795597a4d8e14a7bcf84113748.tar.gz
pyramid-d2ed7edee5991a795597a4d8e14a7bcf84113748.tar.bz2
pyramid-d2ed7edee5991a795597a4d8e14a7bcf84113748.zip
dont try so hard
-rw-r--r--pyramid/config/util.py10
-rw-r--r--pyramid/interfaces.py14
-rw-r--r--pyramid/tests/test_config/test_util.py6
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 ')