returning the category or subcategory folder, if provided

This commit is contained in:
Serghei Mihai 2013-11-20 16:23:49 +01:00
parent f10abf3afa
commit cf9c4994b1
No known key found for this signature in database
GPG Key ID: 76D1C964BF2FA1AF
1 changed files with 6 additions and 2 deletions

View File

@ -43,10 +43,14 @@ def get_categories_from_ocr_code(ocr_code, doctype):
continue
if line.count('|') == 2:
code, category, subcategory = line.strip().split('|')
folder = None
if line.count('|') == 3:
code, category, subcategory, folder = line.strip().split('|')
subcategory = subcategory or None
elif line.count('|') == 1:
code, category = line.strip().split('|')
subcategory = None
subcategory, folder = None, None
if code == ocr_code:
return category, subcategory
return category, subcategory, folder
return None