aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2018-04-02 15:55:50 +0000
committerzsloan2018-04-02 15:55:50 +0000
commit7bd041f66cc4f2548a132e4d69d6533b81f005fc (patch)
treeee77d99cb35c85e7c27da7c55543631b44f1ab22 /wqflask
parentb17b78a46aec1ca515bfef7168232020cf09a151 (diff)
parent92e89794fa57ef1570631403a8ceebf52a2cbc08 (diff)
downloadgenenetwork2-7bd041f66cc4f2548a132e4d69d6533b81f005fc.tar.gz
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into testing
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/other_config/dot.pylintrc249
-rw-r--r--wqflask/other_config/nginx-old.conf108
-rw-r--r--wqflask/other_config/nginx_conf/gn2-lei.conf41
-rw-r--r--wqflask/other_config/nginx_conf/gn2-zach.conf52
-rw-r--r--wqflask/other_config/nginx_conf/gn2.conf41
-rw-r--r--wqflask/other_config/nginx_conf/gn2_sam.conf42
-rw-r--r--wqflask/other_config/nginx_conf/penguin.conf44
-rw-r--r--wqflask/other_config/pylintrc264
-rw-r--r--wqflask/wqflask/collect.py45
-rw-r--r--wqflask/wqflask/static/dbdoc/TODO.md1
-rw-r--r--wqflask/wqflask/user_manager.py57
11 files changed, 53 insertions, 891 deletions
diff --git a/wqflask/other_config/dot.pylintrc b/wqflask/other_config/dot.pylintrc
deleted file mode 100644
index 2774300a..00000000
--- a/wqflask/other_config/dot.pylintrc
+++ /dev/null
@@ -1,249 +0,0 @@
-[MASTER]
-
-# Specify a configuration file.
-#rcfile=
-
-# Python code to execute, usually for sys.path manipulation such as
-# pygtk.require().
-#init-hook=
-
-# Profiled execution.
-profile=no
-
-# Add files or directories to the blacklist. They should be base names, not
-# paths.
-ignore=CVS
-
-# Pickle collected data for later comparisons.
-persistent=yes
-
-# List of plugins (as comma separated values of python modules names) to load,
-# usually to register additional checkers.
-load-plugins=
-
-
-[MESSAGES CONTROL]
-
-# Enable the message, report, category or checker with the given id(s). You can
-# either give multiple identifier separated by comma (,) or put this option
-# multiple time.
-#enable=
-
-# Disable the message, report, category or checker with the given id(s). You
-# can either give multiple identifier separated by comma (,) or put this option
-# multiple time (only on the command line, not in the configuration file where
-# it should appear only once).
-#disable=
-
-
-[REPORTS]
-
-# Set the output format. Available formats are text, parseable, colorized, msvs
-# (visual studio) and html
-output-format=colorized
-
-# Include message's id in output
-include-ids=no
-
-# Put messages in a separate file for each module / package specified on the
-# command line instead of printing them on stdout. Reports (if any) will be
-# written in a file name "pylint_global.[txt|html]".
-files-output=no
-
-# Tells whether to display a full report or only the messages
-reports=yes
-
-# Python expression which should return a note less than 10 (10 is the highest
-# note). You have access to the variables errors warning, statement which
-# respectively contain the number of errors / warnings messages and the total
-# number of statements analyzed. This is used by the global evaluation report
-# (RP0004).
-evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
-
-# Add a comment according to your evaluation note. This is used by the global
-# evaluation report (RP0004).
-comment=no
-
-
-[MISCELLANEOUS]
-
-# List of note tags to take in consideration, separated by a comma.
-notes=FIXME,XXX,TODO
-
-
-[TYPECHECK]
-
-# Tells whether missing members accessed in mixin class should be ignored. A
-# mixin class is detected if its name ends with "mixin" (case insensitive).
-ignore-mixin-members=yes
-
-# List of classes names for which member attributes should not be checked
-# (useful for classes with attributes dynamically set).
-ignored-classes=SQLObject
-
-# When zope mode is activated, add a predefined set of Zope acquired attributes
-# to generated-members.
-zope=no
-
-# List of members which are set dynamically and missed by pylint inference
-# system, and so shouldn't trigger E0201 when accessed. Python regular
-# expressions are accepted.
-generated-members=REQUEST,acl_users,aq_parent
-
-
-[SIMILARITIES]
-
-# Minimum lines number of a similarity.
-min-similarity-lines=4
-
-# Ignore comments when computing similarities.
-ignore-comments=yes
-
-# Ignore docstrings when computing similarities.
-ignore-docstrings=yes
-
-
-[BASIC]
-
-# Required attributes for module, separated by a comma
-required-attributes=
-
-# List of builtins function names that should not be used, separated by a comma
-bad-functions=map,filter,apply,input
-
-# Regular expression which should only match correct module names
-module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
-
-# Regular expression which should only match correct module level names
-const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
-
-# Regular expression which should only match correct class names
-class-rgx=[A-Z_][a-zA-Z0-9]+$
-
-# Regular expression which should only match correct function names
-function-rgx=[a-z_][a-z0-9_]{2,30}$
-
-# Regular expression which should only match correct method names
-method-rgx=[a-z_][a-z0-9_]{2,30}$
-
-# Regular expression which should only match correct instance attribute names
-attr-rgx=[a-z_][a-z0-9_]{2,30}$
-
-# Regular expression which should only match correct argument names
-argument-rgx=[a-z_][a-z0-9_]{2,30}$
-
-# Regular expression which should only match correct variable names
-variable-rgx=[a-z_][a-z0-9_]{2,30}$
-
-# Regular expression which should only match correct list comprehension /
-# generator expression variable names
-inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
-
-# Good variable names which should always be accepted, separated by a comma
-good-names=i,j,k,ex,Run,_
-
-# Bad variable names which should always be refused, separated by a comma
-bad-names=foo,bar,baz,toto,tutu,tata
-
-# Regular expression which should only match functions or classes name which do
-# not require a docstring
-no-docstring-rgx=__.*__
-
-
-[VARIABLES]
-
-# Tells whether we should check for unused import in __init__ files.
-init-import=no
-
-# A regular expression matching the beginning of the name of dummy variables
-# (i.e. not used).
-dummy-variables-rgx=_|dummy
-
-# List of additional names supposed to be defined in builtins. Remember that
-# you should avoid to define new builtins when possible.
-additional-builtins=
-
-
-[FORMAT]
-
-# Maximum number of characters on a single line.
-max-line-length=100
-
-# Maximum number of lines in a module
-max-module-lines=1000
-
-# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
-# tab).
-indent-string=' '
-
-
-[IMPORTS]
-
-# Deprecated modules which should not be used, separated by a comma
-deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
-
-# Create a graph of every (i.e. internal and external) dependencies in the
-# given file (report RP0402 must not be disabled)
-import-graph=
-
-# Create a graph of external dependencies in the given file (report RP0402 must
-# not be disabled)
-ext-import-graph=
-
-# Create a graph of internal dependencies in the given file (report RP0402 must
-# not be disabled)
-int-import-graph=
-
-
-[DESIGN]
-
-# Maximum number of arguments for function / method
-max-args=5
-
-# Argument names that match this expression will be ignored. Default to name
-# with leading underscore
-ignored-argument-names=_.*
-
-# Maximum number of locals for function / method body
-max-locals=15
-
-# Maximum number of return / yield for function / method body
-max-returns=6
-
-# Maximum number of branch for function / method body
-max-branchs=12
-
-# Maximum number of statements in function / method body
-max-statements=50
-
-# Maximum number of parents for a class (see R0901).
-max-parents=7
-
-# Maximum number of attributes for a class (see R0902).
-max-attributes=7
-
-# Minimum number of public methods for a class (see R0903).
-min-public-methods=2
-
-# Maximum number of public methods for a class (see R0904).
-max-public-methods=20
-
-
-[CLASSES]
-
-# List of interface methods to ignore, separated by a comma. This is used for
-# instance to not check methods defines in Zope's Interface base class.
-ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
-
-# List of method names used to declare (i.e. assign) instance attributes.
-defining-attr-methods=__init__,__new__,setUp
-
-# List of valid names for the first argument in a class method.
-valid-classmethod-first-arg=cls
-
-
-[EXCEPTIONS]
-
-# Exceptions that will emit a warning when being caught. Defaults to
-# "Exception"
-overgeneral-exceptions=Exception
diff --git a/wqflask/other_config/nginx-old.conf b/wqflask/other_config/nginx-old.conf
deleted file mode 100644
index 65ee768c..00000000
--- a/wqflask/other_config/nginx-old.conf
+++ /dev/null
@@ -1,108 +0,0 @@
-
-#user nobody;
-worker_processes 1;
-
-#error_log logs/error.log;
-#error_log logs/error.log notice;
-#error_log logs/error.log info;
-
-#pid logs/nginx.pid;
-
-
-events {
- worker_connections 1024;
-}
-
-
-http {
- include mime.types;
- default_type application/octet-stream;
-
- #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
- # '$status $body_bytes_sent "$http_referer" '
- # '"$http_user_agent" "$http_x_forwarded_for"';
-
- #access_log logs/access.log main;
-
- sendfile on;
- #tcp_nopush on;
-
- #keepalive_timeout 0;
- keepalive_timeout 65;
-
- gzip on;
-
- server {
- # Modeled after http://flask.pocoo.org/docs/deploying/wsgi-standalone/
- listen 80;
-
- server_name _;
-
- access_log /var/log/nginx/access.log;
- error_log /var/log/nginx/error.log;
-
- location ^~ /css/ {
- root /home/sam/gene/wqflask/wqflask/static/;
- }
-
- location ^~ /javascript/ {
- root /home/sam/gene/wqflask/wqflask/static/;
- }
-
-# location ^~ /image/ {
-# root /home/sam/gene/wqflask/wqflask/static/;
-# }
-
- location ^~ /images/ {
- root /home/sam/gene/wqflask/wqflask/static/;
- }
-
- location / {
- proxy_pass http://127.0.0.1:5000/;
- proxy_redirect off;
-
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- }
-
- }
-
-
- # another virtual host using mix of IP-, name-, and port-based configuration
- #
- #server {
- # listen 8000;
- # listen somename:8080;
- # server_name somename alias another.alias;
-
- # location / {
- # root html;
- # index index.html index.htm;
- # }
- #}
-
-
- # HTTPS server
- #
- #server {
- # listen 443;
- # server_name localhost;
-
- # ssl on;
- # ssl_certificate cert.pem;
- # ssl_certificate_key cert.key;
-
- # ssl_session_timeout 5m;
-
- # ssl_protocols SSLv2 SSLv3 TLSv1;
- # ssl_ciphers HIGH:!aNULL:!MD5;
- # ssl_prefer_server_ciphers on;
-
- # location / {
- # root html;
- # index index.html index.htm;
- # }
- #}
-
-}
diff --git a/wqflask/other_config/nginx_conf/gn2-lei.conf b/wqflask/other_config/nginx_conf/gn2-lei.conf
deleted file mode 100644
index 893ad435..00000000
--- a/wqflask/other_config/nginx_conf/gn2-lei.conf
+++ /dev/null
@@ -1,41 +0,0 @@
-server {
- # Modeled after http://flask.pocoo.org/docs/deploying/wsgi-standalone/
- listen 80;
-
- server_name gn2-lei.genenetwork.org;
-
- access_log /var/log/nginx/lei_access.log;
- error_log /var/log/nginx/lei_error.log;
-
- location ^~ /css/ {
- root /gene/wqflask/wqflask/static/;
- }
-
- location ^~ /javascript/ {
- root /gene/wqflask/wqflask/static/;
- }
-
-# location ^~ /image/ {
-# root /gene/wqflask/wqflask/static/;
-# }
-
- location ^~ /images/ {
- root /gene/wqflask/wqflask/static/;
- }
-
- ### New - added by Sam
- #location ^~ /static/ {
- # root /gene/wqflask/wqflask/static/;
- #}
-
- location / {
- proxy_pass http://127.0.0.1:5001/;
- proxy_redirect off;
-
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-
- proxy_read_timeout 40m;
- }
-}
diff --git a/wqflask/other_config/nginx_conf/gn2-zach.conf b/wqflask/other_config/nginx_conf/gn2-zach.conf
deleted file mode 100644
index 38347292..00000000
--- a/wqflask/other_config/nginx_conf/gn2-zach.conf
+++ /dev/null
@@ -1,52 +0,0 @@
-server {
- # Modeled after http://flask.pocoo.org/docs/deploying/wsgi-standalone/
- listen 80;
-
- server_name gn2-zach.genenetwork.org;
-
- access_log /var/log/nginx/access.log;
- error_log /var/log/nginx/error.log;
-
- location ^~ /css/ {
- root /gene/wqflask/wqflask/static/;
- }
-
- location ^~ /javascript/ {
- root /gene/wqflask/wqflask/static/;
- }
-
-# location ^~ /image/ {
-# root /gene/wqflask/wqflask/static/;
-# }
-
- location ^~ /images/ {
- root /gene/wqflask/wqflask/static/;
- }
-
- ### New - added by Sam
- #location ^~ /static/ {
- # root /gene/wqflask/wqflask/static/;
- #}
-
- location /plink_gemma/ {
- root /home/zas1024/gene/wqflask/wqflask/;
- autoindex on;
- }
-
- location /download/ {
- root /home/zas1024/gene/wqflask/wqflask/;
- autoindex on;
- }
-
- location / {
- proxy_pass http://127.0.0.1:5002/;
- proxy_redirect off;
-
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-
- proxy_read_timeout 40m;
- }
-}
-
diff --git a/wqflask/other_config/nginx_conf/gn2.conf b/wqflask/other_config/nginx_conf/gn2.conf
deleted file mode 100644
index a51b4113..00000000
--- a/wqflask/other_config/nginx_conf/gn2.conf
+++ /dev/null
@@ -1,41 +0,0 @@
-server {
- # Modeled after http://flask.pocoo.org/docs/deploying/wsgi-standalone/
- listen 80;
-
- server_name gn2.genenetwork.org;
-
- access_log /var/log/nginx/access.log;
- error_log /var/log/nginx/error.log;
-
- location ^~ /css/ {
- root /gene/wqflask/wqflask/static/;
- }
-
- location ^~ /javascript/ {
- root /gene/wqflask/wqflask/static/;
- }
-
-# location ^~ /image/ {
-# root /gene/wqflask/wqflask/static/;
-# }
-
- location ^~ /images/ {
- root /gene/wqflask/wqflask/static/;
- }
-
- ### New - added by Sam
- #location ^~ /static/ {
- # root /gene/wqflask/wqflask/static/;
- #}
-
- location / {
- proxy_pass http://127.0.0.1:5000/;
- proxy_redirect off;
-
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-
- proxy_read_timeout 40m;
- }
-}
diff --git a/wqflask/other_config/nginx_conf/gn2_sam.conf b/wqflask/other_config/nginx_conf/gn2_sam.conf
deleted file mode 100644
index f9abbbd2..00000000
--- a/wqflask/other_config/nginx_conf/gn2_sam.conf
+++ /dev/null
@@ -1,42 +0,0 @@
-server {
- # Modeled after http://flask.pocoo.org/docs/deploying/wsgi-standalone/
- listen 80;
-
- server_name gn2_sam.genenetwork.org;
-
- access_log /var/log/nginx/access.log;
- error_log /var/log/nginx/error.log;
-
- location ^~ /css/ {
- root /gene/wqflask/wqflask/static/;
- }
-
- location ^~ /javascript/ {
- root /gene/wqflask/wqflask/static/;
- }
-
-# location ^~ /image/ {
-# root /gene/wqflask/wqflask/static/;
-# }
-
- location ^~ /images/ {
- root /gene/wqflask/wqflask/static/;
- }
-
- ### New - added by Sam
- #location ^~ /static/ {
- # root /gene/wqflask/wqflask/static/;
- #}
-
- location / {
- proxy_pass http://127.0.0.1:5005/;
- proxy_redirect off;
-
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-
- proxy_read_timeout 40m;
- }
-}
-
diff --git a/wqflask/other_config/nginx_conf/penguin.conf b/wqflask/other_config/nginx_conf/penguin.conf
deleted file mode 100644
index c819951c..00000000
--- a/wqflask/other_config/nginx_conf/penguin.conf
+++ /dev/null
@@ -1,44 +0,0 @@
-server {
- # Modeled after http://flask.pocoo.org/docs/deploying/wsgi-standalone/
-
- client_max_body_size 20M;
- listen 80;
-
- server_name penguin.uthsc.edu;
-
- access_log /var/log/nginx/access.log;
- error_log /var/log/nginx/error.log;
-
- location ^~ /css/ {
- root /gene/wqflask/wqflask/static/;
- }
-
- location ^~ /javascript/ {
- root /gene/wqflask/wqflask/static/;
- }
-
-# location ^~ /image/ {
-# root /gene/wqflask/wqflask/static/;
-# }
-
- location ^~ /images/ {
- root /gene/wqflask/wqflask/static/;
- }
-
- ### New - added by Sam
- #location ^~ /static/ {
- # root /gene/wqflask/wqflask/static/;
- #}
-
- location / {
- proxy_pass http://127.0.0.1:5000/;
- proxy_redirect off;
-
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-
- proxy_read_timeout 40m;
- }
-}
-
diff --git a/wqflask/other_config/pylintrc b/wqflask/other_config/pylintrc
deleted file mode 100644
index b23af7a4..00000000
--- a/wqflask/other_config/pylintrc
+++ /dev/null
@@ -1,264 +0,0 @@
-[MASTER]
-
-# Specify a configuration file.
-#rcfile=
-
-# Python code to execute, usually for sys.path manipulation such as
-# pygtk.require().
-#init-hook=
-
-# Profiled execution.
-profile=no
-
-# Add files or directories to the blacklist. They should be base names, not
-# paths.
-ignore=CVS
-
-# Pickle collected data for later comparisons.
-persistent=yes
-
-# List of plugins (as comma separated values of python modules names) to load,
-# usually to register additional checkers.
-load-plugins=
-
-
-[MESSAGES CONTROL]
-
-# Enable the message, report, category or checker with the given id(s). You can
-# either give multiple identifier separated by comma (,) or put this option
-# multiple time. See also the "--disable" option for examples.
-#enable=
-
-# Disable the message, report, category or checker with the given id(s). You
-# can either give multiple identifiers separated by comma (,) or put this
-# option multiple times (only on the command line, not in the configuration
-# file where it should appear only once).You can also use "--disable=all" to
-# disable everything first and then reenable specific checks. For example, if
-# you want to run only the similarities checker, you can use "--disable=all
-# --enable=similarities". If you want to run only the classes checker, but have
-# no Warning level messages displayed, use"--disable=all --enable=classes
-# --disable=W"
-disable=no-init, star-args, no-member, import-error
-
-
-[REPORTS]
-
-# Set the output format. Available formats are text, parseable, colorized, msvs
-# (visual studio) and html. You can also give a reporter class, eg
-# mypackage.mymodule.MyReporterClass.
-output-format=text
-
-# Include message's id in output
-include-ids=no
-
-# Include symbolic ids of messages in output
-symbols=no
-
-# Put messages in a separate file for each module / package specified on the
-# command line instead of printing them on stdout. Reports (if any) will be
-# written in a file name "pylint_global.[txt|html]".
-files-output=no
-
-# Tells whether to display a full report or only the messages
-reports=yes
-
-# Python expression which should return a note less than 10 (10 is the highest
-# note). You have access to the variables errors warning, statement which
-# respectively contain the number of errors / warnings messages and the total
-# number of statements analyzed. This is used by the global evaluation report
-# (RP0004).
-evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
-
-# Add a comment according to your evaluation note. This is used by the global
-# evaluation report (RP0004).
-comment=no
-
-
-[SIMILARITIES]
-
-# Minimum lines number of a similarity.
-min-similarity-lines=4
-
-# Ignore comments when computing similarities.
-ignore-comments=yes
-
-# Ignore docstrings when computing similarities.
-ignore-docstrings=yes
-
-# Ignore imports when computing similarities.
-ignore-imports=no
-
-
-[VARIABLES]
-
-# Tells whether we should check for unused import in __init__ files.
-init-import=no
-
-# A regular expression matching the beginning of the name of dummy variables
-# (i.e. not used).
-dummy-variables-rgx=_|dummy
-
-# List of additional names supposed to be defined in builtins. Remember that
-# you should avoid to define new builtins when possible.
-additional-builtins=
-
-
-[BASIC]
-
-# Required attributes for module, separated by a comma
-required-attributes=
-
-# List of builtins function names that should not be used, separated by a comma
-bad-functions=map,filter,apply,input
-
-# Regular expression which should only match correct module names
-module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
-
-# Regular expression which should only match correct module level names
-const-rgx=(([A-Z_][A-Za-z0-9_]*)|(__.*__))$
-
-# Regular expression which should only match correct class names
-class-rgx=[A-Z_][a-zA-Z0-9]+$
-
-# Regular expression which should only match correct function names
-function-rgx=[a-z_][a-z0-9_]{2,30}$
-
-# Regular expression which should only match correct method names
-method-rgx=[a-z_][a-z0-9_]{2,30}$
-
-# Regular expression which should only match correct instance attribute names
-attr-rgx=[a-z_][a-z0-9_]{2,30}$
-
-# Regular expression which should only match correct argument names
-argument-rgx=[a-z_][a-z0-9_]{2,30}$
-
-# Regular expression which should only match correct variable names
-variable-rgx=[a-z_][a-z0-9_]{2,30}$
-
-# Regular expression which should only match correct list comprehension /
-# generator expression variable names
-inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
-
-# Good variable names which should always be accepted, separated by a comma
-good-names=i,j,k,ex,Run,_
-
-# Bad variable names which should always be refused, separated by a comma
-bad-names=foo,bar,baz,toto,tutu,tata
-
-# Regular expression which should only match functions or classes name which do
-# not require a docstring
-no-docstring-rgx=__.*__
-
-
-[FORMAT]
-
-# Maximum number of characters on a single line.
-max-line-length=100
-
-# Maximum number of lines in a module
-max-module-lines=1000
-
-# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
-# tab).
-indent-string=' '
-
-
-[MISCELLANEOUS]
-
-# List of note tags to take in consideration, separated by a comma.
-notes=FIXME,XXX,TODO
-
-
-[TYPECHECK]
-
-# Tells whether missing members accessed in mixin class should be ignored. A
-# mixin class is detected if its name ends with "mixin" (case insensitive).
-ignore-mixin-members=yes
-
-# List of classes names for which member attributes should not be checked
-# (useful for classes with attributes dynamically set).
-ignored-classes=SQLObject
-
-# When zope mode is activated, add a predefined set of Zope acquired attributes
-# to generated-members.
-zope=no
-
-# List of members which are set dynamically and missed by pylint inference
-# system, and so shouldn't trigger E0201 when accessed. Python regular
-# expressions are accepted.
-generated-members=REQUEST,acl_users,aq_parent
-
-
-[DESIGN]
-
-# Maximum number of arguments for function / method
-max-args=5
-
-# Argument names that match this expression will be ignored. Default to name
-# with leading underscore
-ignored-argument-names=_.*
-
-# Maximum number of locals for function / method body
-max-locals=15
-
-# Maximum number of return / yield for function / method body
-max-returns=6
-
-# Maximum number of branch for function / method body
-max-branchs=12
-
-# Maximum number of statements in function / method body
-max-statements=50
-
-# Maximum number of parents for a class (see R0901).
-max-parents=7
-
-# Maximum number of attributes for a class (see R0902).
-max-attributes=7
-
-# Minimum number of public methods for a class (see R0903).
-min-public-methods=2
-
-# Maximum number of public methods for a class (see R0904).
-max-public-methods=20
-
-
-[IMPORTS]
-
-# Deprecated modules which should not be used, separated by a comma
-deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
-
-# Create a graph of every (i.e. internal and external) dependencies in the
-# given file (report RP0402 must not be disabled)
-import-graph=
-
-# Create a graph of external dependencies in the given file (report RP0402 must
-# not be disabled)
-ext-import-graph=
-
-# Create a graph of internal dependencies in the given file (report RP0402 must
-# not be disabled)
-int-import-graph=
-
-
-[CLASSES]
-
-# List of interface methods to ignore, separated by a comma. This is used for
-# instance to not check methods defines in Zope's Interface base class.
-ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
-
-# List of method names used to declare (i.e. assign) instance attributes.
-defining-attr-methods=__init__,__new__,setUp
-
-# List of valid names for the first argument in a class method.
-valid-classmethod-first-arg=cls
-
-# List of valid names for the first argument in a metaclass class method.
-valid-metaclass-classmethod-first-arg=mcs
-
-
-[EXCEPTIONS]
-
-# Exceptions that will emit a warning when being caught. Defaults to
-# "Exception"
-overgeneral-exceptions=Exception
diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py
index 0f72b29d..ffc698de 100644
--- a/wqflask/wqflask/collect.py
+++ b/wqflask/wqflask/collect.py
@@ -36,6 +36,10 @@ from utility.formatting import numify
from base import trait
from base.data_set import create_dataset
+import logging
+from utility.logger import getLogger
+logger = getLogger(__name__)
+
def get_collection():
if g.user_session.logged_in:
return UserCollection()
@@ -93,7 +97,7 @@ class AnonCollection(object):
self.traits = list(process_traits(params['traits']))
#len_before = len(Redis.smembers(self.key))
existing_collections = Redis.get(self.key)
- print("existing_collections:", existing_collections)
+ logger.debug("existing_collections:", existing_collections)
if existing_collections != None and existing_collections != "None":
collections_list = json.loads(existing_collections)
collection_position = 0 #ZS: Position of collection in collection_list, if it exists
@@ -158,8 +162,8 @@ class UserCollection(object):
"""User is logged in"""
def add_traits(self, params, collection_name):
- print("---> params are:", params.keys())
- print(" type(params):", type(params))
+ logger.debug("---> params are:", params.keys())
+ logger.debug(" type(params):", type(params))
if collection_name=="Default":
uc = g.user_session.user_ob.get_collection_by_name("Default")
# Doesn't exist so we'll create it
@@ -187,7 +191,7 @@ class UserCollection(object):
db_session.commit()
- print("added to existing, now set is:" + str(uc.members))
+ logger.debug("added to existing, now set is:" + str(uc.members))
report_change(len_before, len_now)
# Probably have to change that
@@ -210,12 +214,12 @@ def process_traits(unprocessed_traits):
def report_change(len_before, len_now):
new_length = len_now - len_before
if new_length:
- print("We've added {} to your collection.".format(
+ logger.debug("We've added {} to your collection.".format(
numify(new_length, 'new trait', 'new traits')))
flash("We've added {} to your collection.".format(
numify(new_length, 'new trait', 'new traits')))
else:
- print("No new traits were added.")
+ logger.debug("No new traits were added.")
@app.route("/collections/add")
@@ -223,8 +227,9 @@ def collections_add():
traits=request.args['traits']
if g.user_session.logged_in:
+ logger.debug("user_session",g.user_session)
user_collections = g.user_session.user_ob.user_collections
- print("user_collections are:", user_collections)
+ logger.debug("user_collections are:", user_collections)
return render_template("collections/add.html",
traits = traits,
collections = user_collections,
@@ -246,11 +251,11 @@ def collections_new():
if "sign_in" in params:
return redirect(url_for('login'))
if "create_new" in params:
- print("in create_new")
+ logger.debug("in create_new")
collection_name = params['new_collection']
return create_new(collection_name)
elif "add_to_existing" in params:
- print("in add to existing")
+ logger.debug("in add to existing")
collection_name = params['existing_collection'].split(":")[1]
if g.user_session.logged_in:
return UserCollection().add_traits(params, collection_name)
@@ -270,7 +275,7 @@ def create_new(collection_name):
if g.user_session.logged_in:
uc = model.UserCollection()
uc.name = collection_name
- print("user_session:", g.user_session.__dict__)
+ logger.debug("user_session:", g.user_session.__dict__)
uc.user = g.user_session.user_id
uc.members = json.dumps(list(traits))
db_session.add(uc)
@@ -286,17 +291,17 @@ def create_new(collection_name):
@app.route("/collections/list")
def list_collections():
params = request.args
- print("PARAMS:", params)
+ logger.debug("PARAMS:", params)
if g.user_session.logged_in:
user_collections = list(g.user_session.user_ob.user_collections)
- print("user_collections are:", user_collections)
+ logger.debug("user_collections are:", user_collections)
return render_template("collections/list.html",
params = params,
collections = user_collections,
)
else:
anon_collections = user_manager.AnonUser().get_collections()
- print("anon_collections are:", anon_collections)
+ logger.debug("anon_collections are:", anon_collections)
return render_template("collections/list.html",
params = params,
collections = anon_collections)
@@ -305,17 +310,17 @@ def list_collections():
@app.route("/collections/remove", methods=('POST',))
def remove_traits():
params = request.form
- print("params are:", params)
+ logger.debug("params are:", params)
if "uc_id" in params:
uc_id = params['uc_id']
uc = model.UserCollection.query.get(uc_id)
traits_to_remove = params.getlist('traits[]')
traits_to_remove = process_traits(traits_to_remove)
- print("\n\n after processing, traits_to_remove:", traits_to_remove)
+ logger.debug("\n\n after processing, traits_to_remove:", traits_to_remove)
all_traits = uc.members_as_set()
members_now = all_traits - traits_to_remove
- print(" members_now:", members_now)
+ logger.debug(" members_now:", members_now)
uc.members = json.dumps(list(members_now))
uc.changed_timestamp = datetime.datetime.utcnow()
db_session.commit()
@@ -332,7 +337,7 @@ def remove_traits():
@app.route("/collections/delete", methods=('POST',))
def delete_collection():
params = request.form
- print("params:", params)
+ logger.debug("params:", params)
if g.user_session.logged_in:
uc_id = params['uc_id']
if len(uc_id.split(":")) > 1:
@@ -363,7 +368,7 @@ def delete_collection():
@app.route("/collections/view")
def view_collection():
params = request.args
- print("PARAMS in view collection:", params)
+ logger.debug("PARAMS in view collection:", params)
if "uc_id" in params:
uc_id = params['uc_id']
@@ -379,7 +384,7 @@ def view_collection():
#this_collection = user_collections[params['collection_id']]
traits = this_collection['members']
- print("in view_collection traits are:", traits)
+ logger.debug("in view_collection traits are:", traits)
trait_obs = []
json_version = []
@@ -405,7 +410,7 @@ def view_collection():
collection_info = dict(trait_obs=trait_obs,
collection_name=this_collection['name'])
if "json" in params:
- print("json_version:", json_version)
+ logger.debug("json_version:", json_version)
return json.dumps(json_version)
else:
return render_template("collections/view.html",
diff --git a/wqflask/wqflask/static/dbdoc/TODO.md b/wqflask/wqflask/static/dbdoc/TODO.md
deleted file mode 100644
index c0a8bab7..00000000
--- a/wqflask/wqflask/static/dbdoc/TODO.md
+++ /dev/null
@@ -1 +0,0 @@
-TODO: Add all database documentation into this folder
diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py
index c55649f3..a0605803 100644
--- a/wqflask/wqflask/user_manager.py
+++ b/wqflask/wqflask/user_manager.py
@@ -23,9 +23,6 @@ import urlparse
import simplejson as json
-import sqlalchemy
-from sqlalchemy import orm
-
#from redis import StrictRedis
import redis
Redis = redis.StrictRedis()
@@ -46,7 +43,6 @@ from wqflask.database import db_session
from wqflask import model
from utility import Bunch, Struct, after
-from utility.tools import LOG_SQL, LOG_SQL_ALCHEMY
import logging
from utility.logger import getLogger
@@ -55,7 +51,10 @@ logger = getLogger(__name__)
from base.data_set import create_datasets_list
import requests
-from utility.elasticsearch_tools import get_elasticsearch_connection, get_user_by_unique_column, save_user
+from utility.elasticsearch_tools import get_elasticsearch_connection, get_user_by_unique_column, get_item_by_unique_column, save_user, es_save_data
+
+from smtplib import SMTP
+from utility.tools import SMTP_CONNECT, SMTP_USERNAME, SMTP_PASSWORD
THREE_DAYS = 60 * 60 * 24 * 3
#THREE_DAYS = 45
@@ -220,6 +219,7 @@ class UserSession(object):
def user_ob(self):
"""Actual sqlalchemy record"""
# Only look it up once if needed, then store it
+ raise "OBSOLETE: use ElasticSearch instead"
try:
if LOG_SQL_ALCHEMY:
logging.getLogger('sqlalchemy.pool').setLevel(logging.DEBUG)
@@ -386,6 +386,7 @@ class ForgotPasswordEmail(VerificationEmail):
"email_address": toaddr,
"timestamp": timestamp()
}
+ es = get_elasticsearch_connection()
es_save_data(es, self.key_prefix, "local", data, verification_code)
subject = self.subject
@@ -437,12 +438,12 @@ def verify_email():
@app.route("/n/password_reset", methods=['GET'])
def password_reset():
logger.debug("in password_reset request.url is:", request.url)
-
# We do this mainly just to assert that it's in proper form for displaying next page
# Really not necessary but doesn't hurt
# user_encode = DecodeUser(ForgotPasswordEmail.key_prefix).reencode_standalone()
verification_code = request.args.get('code')
hmac = request.args.get('hm')
+ es = get_elasticsearch_connection()
if verification_code:
code_details = get_item_by_unique_column(
es
@@ -466,7 +467,6 @@ def password_reset():
@app.route("/n/password_reset_step2", methods=('POST',))
def password_reset_step2():
- from utility.elasticsearch_tools import es
logger.debug("in password_reset request.url is:", request.url)
errors = []
@@ -748,6 +748,7 @@ def forgot_password():
def forgot_password_submit():
params = request.form
email_address = params['email_address']
+ es = get_elasticsearch_connection()
user_details = get_user_by_unique_column(es, "email_address", email_address)
if user_details:
ForgotPasswordEmail(user_details["email_address"])
@@ -840,19 +841,6 @@ def register():
return render_template("new_security/register_user.html", values=params, errors=errors)
-
-
-#@app.route("/n/login", methods=('GET', 'POST'))
-#def login():
-# return user_manager.login()
-#
-#@app.route("/manage/verify")
-#def verify():
-# user_manager.verify_email()
-# return render_template("new_security/verified.html")
-
-
-
################################# Sign and unsign #####################################
def url_for_hmac(endpoint, **values):
@@ -914,15 +902,26 @@ app.jinja_env.globals.update(url_for_hmac=url_for_hmac,
# Redis.rpush("mail_queue", msg)
def send_email(toaddr, msg, fromaddr="no-reply@genenetwork.org"):
- from smtplib import SMTP
- from utility.tools import SMTP_CONNECT, SMTP_USERNAME, SMTP_PASSWORD
- server = SMTP(SMTP_CONNECT)
- server.starttls()
- server.login(SMTP_USERNAME, SMTP_PASSWORD)
- server.sendmail(fromaddr, toaddr, msg)
- server.quit()
-
-
+ """Send an E-mail through SMTP_CONNECT host. If SMTP_USERNAME is not
+ 'UNKNOWN' TLS is used
+
+ """
+ if SMTP_USERNAME == 'UNKNOWN':
+ logger.debug("SMTP: connecting with host "+SMTP_CONNECT)
+ server = SMTP(SMTP_CONNECT)
+ server.sendmail(fromaddr, toaddr, msg)
+ else:
+ logger.debug("SMTP: connecting TLS with host "+SMTP_CONNECT)
+ server = SMTP(SMTP_CONNECT)
+ server.starttls()
+ logger.debug("SMTP: login with user "+SMTP_USERNAME)
+ server.login(SMTP_USERNAME, SMTP_PASSWORD)
+ logger.debug("SMTP: "+fromaddr)
+ logger.debug("SMTP: "+toaddr)
+ logger.debug("SMTP: "+msg)
+ server.sendmail(fromaddr, toaddr, msg)
+ server.quit()
+ logger.info("Successfully sent email to "+toaddr)
class GroupsManager(object):
def __init__(self, kw):