diff --git a/applications/examples/views/default/documentation.html b/applications/examples/views/default/documentation.html index d29ab1a9..d94ddc34 100644 --- a/applications/examples/views/default/documentation.html +++ b/applications/examples/views/default/documentation.html @@ -3,7 +3,7 @@
{{=get_content('main')}}
- +
{{=get_content('official')}} {{=get_content('community')}} diff --git a/applications/examples/views/default/download.html b/applications/examples/views/default/download.html index d8df3871..dbed6375 100644 --- a/applications/examples/views/default/download.html +++ b/applications/examples/views/default/download.html @@ -9,7 +9,8 @@ - + + @@ -17,10 +18,13 @@ + + + - + @@ -48,7 +60,8 @@ +
For Normal UsersFor Normal Users (Py3)For Legacy Users (Py2) For Testers For Developers
- For Windows + Windows binaries - For Windows + Windows binaries + + Windows binaries Git Repository @@ -28,17 +32,25 @@
- For Mac + Mac binaries - For Mac + Mac binaries + + Mac binaries + + Manual
Source Code + Source Code + Source Code
- Manual + Change Log @@ -62,13 +75,19 @@

- The source code version works on Windows and most Unix systems, including Linux, BSD and Mac . It requires Python 2.6 (no more supported), Python 2.7 (stable) or Python 3.5+ (recommended for new projects) already installed on your system. - There are also binary packages for Windows and Mac OS X. They include the Python 2.7 interpreter so you do not need to have it pre-installed. + The source code version works on Windows and most Unix systems, including Linux, BSD and Mac . It requires Python 3.5+ (recommended for new projects) + or Python 2.7+ (stable, for use with legacy apps) already installed on your system. +

+

+ There are also binary packages for Windows and MacOs. They include the Python interpreter version 3.7.4 or 2.7.16, so you do not need to have it pre-installed.

Instructions

-

With the binary packages, after download, just unzip it and then click on web2py.exe (windows) or web2py.app (osx). - If you prefer to run it from source with your own Python interpreter alreay installed, type:

+

With the binary packages, after download, just unzip it and then click on web2py.exe (Windows) or web2py (MacOs).

+

Note that on recent MacOs versions (10.12+) you could face problems in running the binary App program, due to the last changes to the security settings. +In this case, press the 'control' key + click on downloaded file and then 'open' it (confirm the warnings). Finally move the program in Applications and run it from there. +

+

If you prefer to run it from source with your own Python interpreter already installed, type:

{{=CODE("python web2py.py", language=None, counter='>', _class='boxCode')}}

or for more info type:

{{=CODE("python web2py.py -h", language=None, counter='>', _class='boxCode')}} diff --git a/gluon/contrib/login_methods/freeipa_auth.py b/gluon/contrib/login_methods/freeipa_auth.py new file mode 100644 index 00000000..f068fefb --- /dev/null +++ b/gluon/contrib/login_methods/freeipa_auth.py @@ -0,0 +1,59 @@ +import sys +import logging + +try: + import ldap + + ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER) +except Exception as detail: + logging.error('missing ldap, try "pip install python-ldap"') + raise detail + + +def freeipa_auth(server, basedn, group): + """ + custom module for freeIPA auth in web2py + server: freeipa ip + base_dn: root of ldap tree containing user & groups + group: group authing user has to be a member of + + """ + logger = logging.getLogger("web2py.auth.freeipa_auth") + + def freeipa_auth_aux(username, password): + if password == "" or username == "": + logger.warning("blank username / password not allowed") + return False + + bind_user_base = "uid=" + username + ",cn=users," + basedn + ldap_filter = "memberof=cn=" + group + ",cn=groups," + basedn + + session = ldap.initialize("ldaps://" + server + ":636") + try: + session.bind_s(bind_user_base, password) + except ldap.LDAPError: + import traceback + + logger.warning("[%s] Error in ldap bind" % str(username)) + logger.debug(traceback.format_exc()) + return False + + try: + result = session.search_s( + bind_user_base, ldap.SCOPE_SUBTREE, ldap_filter, ["member"] + ) + session.unbind() + except ldap.LDAPError as detail: + logger.warning( + "ldap_auth: searc %s for %s resulted in %s: %s\n" + % (bind_user_base, ldap_filter, exc_type, exc_value) + ) + + try: + if result == list(): + return False + return True + except: + return False + + return freeipa_auth_aux diff --git a/gluon/scheduler.py b/gluon/scheduler.py index 3510dfb9..75e75c74 100644 --- a/gluon/scheduler.py +++ b/gluon/scheduler.py @@ -596,12 +596,12 @@ class Scheduler(threading.Thread): utc_time(bool): do all datetime calculations assuming UTC as the timezone. Remember to pass `start_time` and `stop_time` to tasks accordingly - + use_spawn(bool): use spawn for subprocess (only useable with python3) """ def __init__(self, db, tasks=None, migrate=True, worker_name=None, group_names=None, heartbeat=HEARTBEAT, - max_empty_runs=0, discard_results=False, utc_time=False): + max_empty_runs=0, discard_results=False, utc_time=False, use_spawn=False): threading.Thread.__init__(self) self.setDaemon(True) @@ -639,6 +639,7 @@ class Scheduler(threading.Thread): current._scheduler = self self.define_tables(db, migrate=migrate) + self.use_spawn = use_spawn def execute(self, task): """Start the background process. @@ -649,10 +650,19 @@ class Scheduler(threading.Thread): Returns: a `TaskReport` object """ - outq = multiprocessing.Queue() - retq = multiprocessing.Queue(maxsize=1) - self.process = p = \ - multiprocessing.Process(target=executor, args=(retq, task, outq)) + outq = None + retq = None + if (self.use_spawn and not PY2): + ctx = multiprocessing.get_context('spawn') + outq = ctx.Queue() + retq = ctx.Queue(maxsize=1) + sel.process = p = ctx.Process(target=executor, args=(retq, task, outq)) + else: + outq = multiprocessing.Queue() + retq = multiprocessing.Queue(maxsize=1) + self.process = p = \ + multiprocessing.Process(target=executor, args=(retq, task, outq)) + self.process_queues = (retq, outq) logger.debug(' task starting')