Commit a8a22117 by aa.gusti

perbaikan captcha

1 parent 4d23405e
from __future__ import print_function
import os
import re
import mimetypes
import csv
import calendar
import csv
import datetime
import io
import locale
import logging
import mimetypes
import os
import re
from json import JSONEncoder
from random import choice
from string import (ascii_uppercase, ascii_lowercase, digits, )
import locale
import colander
import pytz
import io
from pyramid.httpexceptions import HTTPNotFound
from pyramid.threadlocal import get_current_registry
from json import JSONEncoder
import logging
log = logging.getLogger(__name__)
################
# Phone number #
################
MSISDN_ALLOW_CHARS = map(lambda x: str(x), range(10)) # + ['+']
class CSRFSchema(colander.Schema):
def after_bind(self, schema, kwargs):
request = kwargs["request"]
......@@ -34,6 +34,7 @@ class CSRFSchema(colander.Schema):
default=csrf_token
)
def get_msisdn(msisdn, country='+62'):
"""
Digunakan untuk pengecekan no telp suatu negara
......@@ -474,7 +475,7 @@ def file_response(request, f, filename, type):
class Upload(SaveFile):
def save_to_file(self, input_file, ext, filename=None):
if filename:
fullpath = os.path.join(self.dir_path, filename, ext)
fullpath = os.path.join(self.dir_path, f"{filename}")
else:
fullpath = self.create_fullpath(ext)
log.debug(f"Saving file to: {fullpath}")
......@@ -491,6 +492,7 @@ class Upload(SaveFile):
def save(self, request, name, exts=None, filename=None):
input_file = request.POST[name].file
ext = get_ext(request.POST[name].filename)
ext = ext and ext.lower() or None
if exts and ext not in exts:
raise InvalidExtension(exts)
......
......@@ -284,7 +284,8 @@ def nop_to_id(row):
def query_nop(table):
return func.concat(table.kd_propinsi, func.concat('.',
return func.concat(table.kd_propinsi,
func.concat('.',
func.concat(table.kd_dati2, func.concat('-',
func.concat(
table.kd_kecamatan,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!