Browse Source

publish muk_utils - 12.0

pull/30/head
MuK IT GmbH 6 years ago
parent
commit
244f426f2d
  1. 2
      muk_utils/__manifest__.py
  2. 6
      muk_utils/tools/file.py

2
muk_utils/__manifest__.py

@ -19,7 +19,7 @@
{ {
"name": "MuK Utils", "name": "MuK Utils",
"summary": """Utility Features""", "summary": """Utility Features""",
"version": '12.0.1.6.13',
"version": '12.0.1.6.14',
"category": 'Extra Tools', "category": 'Extra Tools',
"license": "AGPL-3", "license": "AGPL-3",
"author": "MuK IT", "author": "MuK IT",

6
muk_utils/tools/file.py

@ -40,13 +40,13 @@ _logger = logging.getLogger(__name__)
# File Helper # File Helper
#---------------------------------------------------------- #----------------------------------------------------------
def slugify(value):
def slugify(value, lower=True):
value = str(unicodedata.normalize('NFKD', value)) value = str(unicodedata.normalize('NFKD', value))
value = str(value.encode('ascii', 'ignore')) value = str(value.encode('ascii', 'ignore'))
value = str(re.sub('[^\w\s-]', '', value)) value = str(re.sub('[^\w\s-]', '', value))
value = str(re.sub('[-\s]+', '-', value)) value = str(re.sub('[-\s]+', '-', value))
value = value.strip().lower()
return value
value = value.lower() if lower else value
return value.strip()
def check_name(name): def check_name(name):
tmp_dir = tempfile.mkdtemp() tmp_dir = tempfile.mkdtemp()

Loading…
Cancel
Save