コード例 #1
0
ファイル: genetic_mapping.py プロジェクト: AndersenLab/CeNDR
def report_namecheck(report_name):
    report_slug = slugify(report_name)
    report_hash = str(hashlib.sha224(report_slug).hexdigest()[0:20])
    if report.filter(report.report_slug == report_slug).count() > 0:
        return {"error": "Report name reserved."}
    if len(report_slug) > 40:
        return {"error": "Report name may not be > 40 characters."}
    else:
        return {"report_slug": report_slug, "report_hash": report_hash}
コード例 #2
0
ファイル: genetic_mapping.py プロジェクト: AndersenLab/CeNDR
def valid_url(url, encrypt):
    url_out = slugify(url)
    if report.filter(report.report_slug == url_out).count() > 0:
        return {"error": "Report name reserved."}
    if encrypt:
        url_out = str(hashlib.sha224(url_out).hexdigest()[0:20])
    if len(url_out) > 40:
        return {"error": "Report name may not be > 40 characters."}
    else:
        return url_out