Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __label_cmp(self, other):
"""
Comparaison function. Can be used to sort labels alphabetically.
"""
if other is None:
return -1
label_name = strip_accents(self.name).lower()
other_name = strip_accents(other.name).lower()
cmp_r = cmp(label_name, other_name)
if cmp_r != 0:
return cmp_r
return cmp(self.get_color_str(), other.get_color_str())
def __label_cmp(self, other):
"""
Comparaison function. Can be used to sort labels alphabetically.
"""
if other is None:
return -1
label_name = strip_accents(self.name).lower()
other_name = strip_accents(other.name).lower()
cmp_r = cmp(label_name, other_name)
if cmp_r != 0:
return cmp_r
return cmp(self.get_color_str(), other.get_color_str())
dochash = (u"%X" % dochash)
doc_txt = doc.get_index_text()
assert(isinstance(doc_txt, unicode))
labels_txt = doc.get_index_labels()
assert(isinstance(labels_txt, unicode))
query = whoosh.query.Term("docid", docid)
index_writer.delete_by_query(query)
index_writer.update_document(
docid=docid,
doctype=doc.doctype,
docfilehash=dochash,
content=strip_accents(doc.get_index_text()),
label=strip_accents(doc.get_index_labels()),
date=doc.date,
last_read=last_mod
)
return True
dochash = doc.get_docfilehash()
dochash = (u"%X" % dochash)
doc_txt = doc.get_index_text()
assert(isinstance(doc_txt, unicode))
labels_txt = doc.get_index_labels()
assert(isinstance(labels_txt, unicode))
query = whoosh.query.Term("docid", docid)
index_writer.delete_by_query(query)
index_writer.update_document(
docid=docid,
doctype=doc.doctype,
docfilehash=dochash,
content=strip_accents(doc.get_index_text()),
label=strip_accents(doc.get_index_labels()),
date=doc.date,
last_read=last_mod
)
return True