This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def login_required(f): | |
def decorated_function(*args, **kwargs): | |
if g.user is None: | |
return redirect(url_for('login', next=request.url)) | |
return f(*args, **kwargs) | |
return decorated_function | |
@app.route('/api/log') | |
@login_required |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_printable_size(byte_size): | |
""" | |
A bit is the smallest unit, it's either 0 or 1 | |
1 byte = 1 octet = 8 bits | |
1 kB = 1 kilobyte = 1000 bytes = 10^3 bytes | |
1 KiB = 1 kibibyte = 1024 bytes = 2^10 bytes | |
1 KB = 1 kibibyte OR kilobyte ~= 1024 bytes ~= 2^10 bytes (it usually means 1024 bytes but sometimes it's 1000... ask the sysadmin ;) ) | |
1 kb = 1 kilobits = 1000 bits (this notation should not be used, as it is very confusing) | |
1 ko = 1 kilooctet = 1000 octets = 1000 bytes = 1 kB |