Skip to content

Commit

Permalink
Pep8.
Browse files Browse the repository at this point in the history
  • Loading branch information
tisto committed Dec 31, 2014
1 parent a82b4ed commit dce7783
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/collective/solr/browser/suggest.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __call__(self):
connection.solrBase + '/autocomplete?' + params, '', {})
results = json.loads(response.read())

if not 'grouped' in results:
if 'grouped' not in results:
return json.dumps([])

groups = results.get('grouped')['title_autocomplete']['groups']
Expand Down
2 changes: 1 addition & 1 deletion src/collective/solr/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def unindex(self, obj):

data, missing = self.getData(obj, attributes=[uniqueKey])
prepareData(data)
if not uniqueKey in data:
if uniqueKey not in data:
msg = 'Can not unindex: no unique key for object %r'
logger.info(msg, obj)
return
Expand Down
6 changes: 6 additions & 0 deletions src/collective/solr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def prepareData(data):


simpleTerm = compile(r'^[\w\d]+$', UNICODE)


def isSimpleTerm(term):
if isinstance(term, str):
term = unicode(term, 'utf-8', 'ignore')
Expand All @@ -80,6 +82,8 @@ def isSimpleTerm(term):
operators = compile(r'(.*)\s+(AND|OR|NOT)\s+', UNICODE)
simpleCharacters = compile(r'^[\w\d\?\*\s]+$', UNICODE)
is_digit = compile('\d', UNICODE)


def isSimpleSearch(term):
term = term.strip()
if isinstance(term, str):
Expand Down Expand Up @@ -131,6 +135,8 @@ def splitSimpleSearch(term):


wildCard = compile(r'^[\w\d\s*?]*[*?]+[\w\d\s*?]*$', UNICODE)


def isWildCard(term):
if isinstance(term, str):
term = unicode(term, 'utf-8', 'ignore')
Expand Down

0 comments on commit dce7783

Please sign in to comment.