Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Some errors don't have line or column, return None #5

Merged
merged 1 commit into from

2 participants

@coledarr

re.search() can return None, if it does don't try to return non-existent
results

(sorry that the previous pull request was from master instead of a feature branch)

@coledarr coledarr Some errors don't have line or column, return None
re.search() can return None, if it does don't try to return not existant
restults
e008479
@actionshrimp actionshrimp merged commit 7ed86d6 into actionshrimp:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 16, 2012
  1. @coledarr

    Some errors don't have line or column, return None

    coledarr authored
    re.search() can return None, if it does don't try to return not existant
    restults
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 2 deletions.
  1. +5 −2 xpath/xpath.py
View
7 xpath/xpath.py 100644 → 100755
@@ -439,8 +439,11 @@ def set_error_position(self, error):
def first_group_match(self, pattern, text):
search = re.search(pattern, text)
- groups = search.groups()
- return groups[0]
+ if search is not None:
+ groups = search.groups()
+ return groups[0]
+ else:
+ return None
class XPathSearchErrorResult(XPathErrorResult):
def __init__(self, error, xpath):
Something went wrong with that request. Please try again.