Merge branch 'master' of github.com:web2py/web2py

This commit is contained in:
mdipierro
2019-11-02 23:09:04 -07:00
4 changed files with 106 additions and 18 deletions
@@ -3,7 +3,7 @@
<div>
{{=get_content('main')}}
<center>
<iframe src="//player.vimeo.com/hubnut/album/3016728?color=ff6600&amp;background=ffffff&amp;slideshow=1&amp;video_title=1&amp;video_byline=1" width="400" height="300" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<iframe src="https://player.vimeo.com/video/104800778?color=ff6600&amp;background=ffffff&amp;slideshow=1&amp;video_title=1&amp;video_byline=1" width="400" height="300" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
</center>
{{=get_content('official')}}
{{=get_content('community')}}
@@ -9,7 +9,8 @@
<table class="twothirds">
<thead>
<tr>
<th>For Normal Users</th>
<th>For Normal Users (Py3)</th>
<th>For Legacy Users (Py2)</th>
<th>For Testers</th>
<th>For Developers</th>
</tr>
@@ -17,10 +18,13 @@
<tbody>
<tr>
<td>
<a class="btn btn180 rounded green" href="https://mdipierro.pythonanywhere.com/examples/static/web2py_win.zip">For Windows</a>
<a class="btn btn180 rounded green" href="https://mdipierro.pythonanywhere.com/examples/static/web2py_win.zip">Windows binaries</a>
</td>
<td>
<a class="btn btn180 rounded yellow" href="https://mdipierro.pythonanywhere.com/examples/static/nightly/web2py_win.zip">For Windows</a>
<a class="btn btn180 rounded" href="https://mdipierro.pythonanywhere.com/examples/static/web2py_win_py2.zip">Windows binaries</a>
</td>
<td>
<a class="btn btn180 rounded yellow" href="https://mdipierro.pythonanywhere.com/examples/static/nightly/web2py_win.zip">Windows binaries</a>
</td>
<td>
<a class="btn btn180 rounded red" href="http://github.com/web2py/web2py/">Git Repository</a>
@@ -28,17 +32,25 @@
</tr>
<tr>
<td>
<a class="btn btn180 rounded green" href="https://mdipierro.pythonanywhere.com/examples/static/web2py_osx.zip">For Mac</a>
<a class="btn btn180 rounded green" href="https://mdipierro.pythonanywhere.com/examples/static/web2py_osx.zip">Mac binaries</a>
</td>
<td>
<a class="btn btn180 rounded yellow" href="https://mdipierro.pythonanywhere.com/examples/static/nightly/web2py_osx.zip">For Mac</a>
<a class="btn btn180 rounded" href="https://mdipierro.pythonanywhere.com/examples/static/web2py_osx_py2.zip">Mac binaries</a>
</td>
<td>
<a class="btn btn180 rounded yellow" href="https://mdipierro.pythonanywhere.com/examples/static/nightly/web2py_osx.zip">Mac binaries</a>
</td>
<td>
<a class="btn btn180 rounded" href="http://mdipierro.github.io/web2py/web2py_manual_5th.pdf">Manual</a>
</td>
<td></td>
</tr>
<tr>
<td>
<a class="btn btn180 rounded green" href="https://mdipierro.pythonanywhere.com/examples/static/web2py_src.zip">Source Code</a>
</td>
<td>
<a class="btn btn180 rounded" href="https://mdipierro.pythonanywhere.com/examples/static/web2py_src.zip">Source Code</a>
</td>
<td>
<a class="btn btn180 rounded yellow" href="https://mdipierro.pythonanywhere.com/examples/static/nightly/web2py_src.zip">Source Code</a>
</td>
@@ -48,7 +60,8 @@
</tr>
<tr>
<td>
<a class="btn btn180 rounded green" href="http://mdipierro.github.io/web2py/web2py_manual_5th.pdf">Manual</a>
</td>
<td>
</td>
<td>
<a class="btn btn180 rounded" href="https://github.com/web2py/web2py/releases">Change Log</a>
@@ -62,13 +75,19 @@
</center>
<p style="text-align:left;">
The source code version works on Windows and most Unix systems, including <b>Linux</b>, <b>BSD</b> and <b>Mac</b> . 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 <b>Linux</b>, <b>BSD</b> and <b>Mac</b> . It requires Python 3.5+ (recommended for new projects)
or Python 2.7+ (stable, for use with legacy apps) already installed on your system.
</p>
<p style="text-align:left;">
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.
</p>
<h3>Instructions</h3>
<p>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:</p>
<p>With the binary packages, after download, just unzip it and then click on web2py.exe (Windows) or web2py (MacOs).</p>
<p>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.
</p>
<p> If you prefer to run it from source with your own Python interpreter already installed, type:</p>
{{=CODE("python web2py.py", language=None, counter='>', _class='boxCode')}}
<p>or for more info type:</p>
{{=CODE("python web2py.py -h", language=None, counter='>', _class='boxCode')}}
@@ -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
+16 -6
View File
@@ -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')