restored some of the deleted files
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
This script will update untranslated messages in target from source (target and source are both language files)
|
||||
Usage:
|
||||
this can be used as first step when creating language file for new but very similar language
|
||||
or if you want update your app from welcome app of newer web2py version
|
||||
or in non-standard scenarios when you work on target and from any reason you have partial translation in source
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.append(os.path.join(*__file__.split(os.sep)[:-2] or ['.']))
|
||||
|
||||
from gluon.languages import update_from_langfile
|
||||
import argparse
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='Use to set untranslated messages in the translation file from another one.')
|
||||
parser.add_argument(
|
||||
'-t', '--target',
|
||||
required=True,
|
||||
dest="target",
|
||||
help="Specify language file (rw) where untranslated messages will be updated if possible"
|
||||
)
|
||||
parser.add_argument(
|
||||
'-s', '--source',
|
||||
required=True,
|
||||
dest="source",
|
||||
help="Specify language file (ro) where seek for translations"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
update_from_langfile(args.target, args.source)
|
||||
|
||||
print '%s was updated.' % args.target
|
||||
@@ -0,0 +1,115 @@
|
||||
user nginx nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error_log info;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
use epoll;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main
|
||||
'$remote_addr - $remote_user [$time_local] '
|
||||
'"$request" $status $bytes_sent '
|
||||
'"$http_referer" "$http_user_agent" '
|
||||
'"$gzip_ratio"';
|
||||
|
||||
client_header_timeout 10m;
|
||||
client_body_timeout 10m;
|
||||
send_timeout 10m;
|
||||
|
||||
connection_pool_size 256;
|
||||
client_header_buffer_size 1k;
|
||||
large_client_header_buffers 4 2k;
|
||||
request_pool_size 4k;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1100;
|
||||
gzip_buffers 4 8k;
|
||||
gzip_types text/plain;
|
||||
|
||||
output_buffers 1 32k;
|
||||
postpone_output 1460;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
keepalive_timeout 75 20;
|
||||
|
||||
ignore_invalid_headers on;
|
||||
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
|
||||
index index.html;
|
||||
|
||||
server {
|
||||
listen 127.0.0.1;
|
||||
server_name localhost;
|
||||
|
||||
access_log /var/log/nginx/localhost.access_log main;
|
||||
error_log /var/log/nginx/localhost.error_log info;
|
||||
|
||||
root /var/www/localhost/htdocs;
|
||||
}
|
||||
|
||||
# SSL example
|
||||
server {
|
||||
listen 127.0.0.1:443;
|
||||
server_name localhost;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /etc/ssl/nginx/nginx-server.pem;
|
||||
ssl_client_certificate /etc/ssl/nginx/cacert.pem;
|
||||
ssl_certificate_key /etc/ssl/nginx/nginx.key;
|
||||
ssl_verify_client optional;
|
||||
|
||||
access_log /var/log/nginx/localhost.ssl_access_log main;
|
||||
error_log /var/log/nginx/localhost.ssl_error_log info;
|
||||
|
||||
root /var/www/localhost/htdocs;
|
||||
|
||||
set $web2pyroot /home/Desktop/source/michelecomitini-facebookaccess;
|
||||
|
||||
|
||||
location /pki/ {
|
||||
root /var/www/localhost/html;
|
||||
}
|
||||
|
||||
location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
|
||||
alias $web2pyroot/applications/$1/static/$2;
|
||||
expires max;
|
||||
}
|
||||
|
||||
location / {
|
||||
include /etc/nginx/scgi_params;
|
||||
scgi_pass 127.0.0.1:4000;
|
||||
|
||||
#Module ngx_http_ssl_module supports the following built-in variables:
|
||||
|
||||
#$ssl_cipher returns the cipher suite being used for the currently established SSL/TLS connection
|
||||
#$ssl_client_serial returns the serial number of the client certificate for the currently established SSL/TLS connection — if applicable, i.e., if client authentication is activated in the connection
|
||||
#$ssl_client_s_dn returns the subject Distinguished Name (DN) of the client certificate for the currently established SSL/TLS connection — if applicable, i.e., if client authentication is activated in the connection
|
||||
#$ssl_client_i_dn returns the issuer DN of the client certificate for the currently established SSL/TLS connection — if applicable, i.e., if client authentication is activated in the connection
|
||||
#$ssl_protocol returns the protocol of the currently established SSL/TLS connection — depending on the configuration and client available options it's one of SSLv2, SSLv3 or TLSv1
|
||||
#$ssl_session_id the Session ID of the established secure connection — requires Nginx version greater or equal to 0.8.20
|
||||
#$ssl_client_cert
|
||||
#$ssl_client_raw_cert
|
||||
#$ssl_client_verify takes the value "SUCCESS" when the client certificate is successfully verified
|
||||
scgi_param SSL_PROTOCOL $ssl_protocol;
|
||||
scgi_param HTTPS on;
|
||||
scgi_param SSL_CIPHER $ssl_cipher;
|
||||
scgi_param SSL_CLIENT_SERIAL $ssl_client_serial;
|
||||
scgi_param SSL_CLIENT_S_DN $ssl_client_s_dn;
|
||||
scgi_param SSL_CLIENT_I_DN $ssl_client_i_dn;
|
||||
scgi_param SSL_SESSION_ID $ssl_session_id;
|
||||
scgi_param SSL_CLIENT_CERT $ssl_client_cert;
|
||||
scgi_param SSL_CLIENT_RAW_CERT $ssl_client_raw_cert;
|
||||
scgi_param SSL_CLIENT_VERIFY $ssl_client_verify;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Use to update official_top_level_domains in gluon/validators.py
|
||||
"""
|
||||
|
||||
import itertools
|
||||
import operator
|
||||
import urllib2
|
||||
|
||||
LIMIT = 70
|
||||
PREFIX = ' '
|
||||
TLDS_URL = 'http://data.iana.org/TLD/tlds-alpha-by-domain.txt'
|
||||
|
||||
resp = urllib2.urlopen(TLDS_URL)
|
||||
content = resp.read()
|
||||
|
||||
valid_lines = [a.strip().lower() for a in content.split('\n') if a.strip() and a.strip()[0] != '#']
|
||||
valid_lines += ['localhost']
|
||||
|
||||
print 'Fetched TLDs are %s' % len(valid_lines)
|
||||
|
||||
results = [list(g) for k, g in itertools.groupby(sorted(valid_lines), key=operator.itemgetter(0))]
|
||||
|
||||
output = []
|
||||
line = "'%s', "
|
||||
|
||||
for a in results:
|
||||
output.append('%s# %s' % (PREFIX, a[-1][0]))
|
||||
thisline = PREFIX
|
||||
for c in a:
|
||||
newline = thisline + line % c
|
||||
if len(newline) > 70:
|
||||
output.append(thisline[:-1])
|
||||
thisline = PREFIX + line % c
|
||||
else:
|
||||
thisline += line % c
|
||||
if thisline:
|
||||
output.append(thisline[:-1])
|
||||
|
||||
print '[\n' + '\n'.join(output)[:-1] + '\n]'
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
## launch with python web2py.py -S myapp -R scripts/zip_static_files.py
|
||||
|
||||
|
||||
import os
|
||||
import gzip
|
||||
|
||||
|
||||
def zip_static(filelist=[]):
|
||||
tsave = 0
|
||||
for fi in filelist:
|
||||
extension = os.path.splitext(fi)
|
||||
extension = len(extension) > 1 and extension[1] or None
|
||||
if not extension or extension not in ALLOWED_EXTS:
|
||||
print 'skipping %s' % os.path.basename(fi)
|
||||
continue
|
||||
fstats = os.stat(fi)
|
||||
atime, mtime = fstats.st_atime, fstats.st_mtime
|
||||
gfi = fi + '.gz'
|
||||
if os.path.isfile(gfi):
|
||||
zstats = os.stat(gfi)
|
||||
zatime, zmtime = zstats.st_atime, zstats.st_mtime
|
||||
if zatime == atime and zmtime == mtime:
|
||||
print 'skipping %s, already gzipped to the latest version' % os.path.basename(fi)
|
||||
continue
|
||||
print 'gzipping %s to %s' % (
|
||||
os.path.basename(fi), os.path.basename(gfi))
|
||||
f_in = open(fi, 'rb')
|
||||
f_out = gzip.open(gfi, 'wb')
|
||||
f_out.writelines(f_in)
|
||||
f_out.close()
|
||||
f_in.close()
|
||||
os.utime(gfi, (atime, mtime))
|
||||
saved = fstats.st_size - os.stat(gfi).st_size
|
||||
tsave += saved
|
||||
|
||||
print 'saved %s KB' % (int(tsave) / 1000.0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
ALLOWED_EXTS = ['.css', '.js']
|
||||
static_path = os.path.abspath(os.path.join(request.folder, 'static'))
|
||||
filelist = []
|
||||
for root, dir, files in os.walk(static_path):
|
||||
for file in files:
|
||||
filelist.append(os.path.join(root, file))
|
||||
|
||||
zip_static(filelist)
|
||||
Reference in New Issue
Block a user