Skip to content

Commit

Permalink
Merge pull request #853 from OneZoom/main
Browse files Browse the repository at this point in the history
Merge main into production
  • Loading branch information
hyanwong committed May 7, 2024
2 parents 8f80699 + e706d1f commit 78c851c
Show file tree
Hide file tree
Showing 26 changed files with 180 additions and 166 deletions.
2 changes: 1 addition & 1 deletion OZprivate/ServerScripts/Utilities/picProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def info(*objs):
# takes as an input "any" "verified" or "pd" and also the src column (a number)
# it will OVERWRITE any rippled up pictures it finds for the same OTTID
def ripple_leaf(type_in):
info("rippling up from leaves to first nodes for {}".format(type_in))
info("Rippling up from leaves to first nodes for {}".format(type_in))
index_in = Images_OTT_head.index("overall_best_{}".format(type_in))
for row in range(len(Images_OTT_data_T)):
# function loops over all images in Images_OTT_data_T
Expand Down
9 changes: 5 additions & 4 deletions controllers/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,11 @@ def sponsor_renew_request():
INPUT(_name='user_identifier', _class="uk-input uk-margin-bottom"),
INPUT(_type='submit', _class="oz-pill pill-leaf"))
if form.accepts(request.vars, session=None):
response.flash = sponsor_renew_request_logic(
session.flash = sponsor_renew_request_logic(
form.vars.user_identifier.strip(),
mailer=ozmail.get_mailer()
)
redirect(URL())
return dict(
form=form,
)
Expand Down Expand Up @@ -2117,19 +2118,19 @@ def otop_MD():

""" Some controllers that simply redirect to other OZ viewer pages, for brevity """
def gnathostomata():
redirect(URL('default', 'life.html/@Gnathostomata=278114', url_encode=False))
redirect(URL('default', 'life/@Gnathostomata=278114', url_encode=False, extension=False))

#def kew_plants():
# """
# redirect to the land plants
# """
redirect(URL('default', 'kew.html/@Embryophyta?init=jump', url_encode=False))
redirect(URL('default', 'kew/@Embryophyta?init=jump', url_encode=False, extension=False))

#def kew_fungi():
# """
# redirect to the fungi plants
# """
# redirect(URL('default', 'kew.html/@Embryophyta?init=jump', url_encode=False))
# redirect(URL('default', 'kew/@Embryophyta?init=jump', url_encode=False, extension=False))

def list_controllers():
"""
Expand Down
15 changes: 12 additions & 3 deletions install-nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@ WWW_IMAGES_SERVER_NAME="$(echo ${WWW_SERVER_NAME} | sed 's/^w*/images/')" # ima
[ -d "/etc/nginx" ] && NGINX_PATH="/etc/nginx"
[ -d "/usr/local/etc/nginx" ] && NGINX_PATH="/usr/local/etc/nginx"
mkdir -p "${NGINX_PATH}/conf.d/"
NGINX_LOG_PATH="/var/log/nginx"
NGINX_LOG_PATH="/var/log/http"
NGINX_CERT_PATH="/var/db/acme/live"
NGINX_DHPARAM_PATH="${NGINX_PATH}/dhparam.pem"
[ -d "/var/acme" ] && NGINX_CHALLENGE_PATH="/var/acme"
NGINX_CHALLENGE_PATH="${NGINX_CHALLENGE_PATH-/var/acme}"

# Generate NGINX_DHPARAM
[ -e "${NGINX_DHPARAM_PATH}" ] || openssl dhparam -out "${NGINX_DHPARAM_PATH}" 4096

if [ ! -f "${NGINX_CERT_PATH}/${WWW_SERVER_NAME}/privkey" ]; then
# Fall back to self-signed bootstrap-cert
NGINX_CERT_PATH="${NGINX_PATH}/snakeoil-certs"
NGINX_CHALLENGE_PATH="/dev/null"
for SN in onezoom.org ${WWW_SERVER_NAME} ${WWW_IMAGES_SERVER_NAME}; do
mkdir -p "${NGINX_CERT_PATH}/${SN}"
if [ ! -e "${NGINX_CERT_PATH}/${SN}/privkey.pem" ]; then
Expand All @@ -35,6 +34,16 @@ if [ ! -f "${NGINX_CERT_PATH}/${WWW_SERVER_NAME}/privkey" ]; then
done
fi

if [ ! -d "${NGINX_CHALLENGE_PATH}" ]; then
# No challenge path, acmetool is probably not installed
NGINX_CHALLENGE_PATH="/dev/null"
fi

if [ ! -d "${NGINX_LOG_PATH}" ]; then
# Ensure log dir exists
mkdir -p -- "${NGINX_LOG_PATH}"
fi

# Create NGINX config
cat <<EOF > ${NGINX_PATH}/nginx.conf
#### Generated by $0 - DO NOT EDIT
Expand Down
2 changes: 2 additions & 0 deletions install-supervisord.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ process_name=%(program_name)s%(process_num)d
numprocs=5
[program:${WEB2PY_NAME}_background_tasks]
; includes sending email autoreminders. Stop this specific task via:
; supervisorctl stop ${WEB2PY_NAME}_background_tasks
directory=${WEB2PY_PATH}
user=${APP_USER}
group=${APP_GROUP}
Expand Down
4 changes: 2 additions & 2 deletions models/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
## Configure i18n
T.set_current_languages('en', 'en-en')
# Allow translators to add new languages e.g. on the test (beta) site, but not on prod
T.is_writable = is_testing
T.is_writable = is_testing and myconf.get('general.allow_translation_string_writing')
#ALL pages can set ?lang=XXX to override the browser default for translating strings
if request.vars.lang:
T.force(request.vars.lang)
Expand Down Expand Up @@ -245,7 +245,7 @@
Field('wikidata', type='integer'),
Field('wikipedia_lang_flag', type='integer'), #
Field('eol', type='integer'),
Field('rnk', type='string', length=name_rank_chars),
Field('rnk', type='string', length=name_rank_chars), # The taxonomic rank, e.f. "genus"
Field('raw_popularity', type='double'),
Field('popularity', type='double'),
#the following 5 fields are sources listed by the OpenTree
Expand Down
48 changes: 24 additions & 24 deletions models/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,39 @@
# james todo manager only menu?

response.menu = [
(T('For Everyone'), False, None , [ #need to set url_encode=False to avoid web2py quoting the @ sign
(T('A view of all known life'), False, URL('default', 'introduction', url_encode=False)),
(T('Your name on the tree'), False, URL('default' , 'sponsor.html')),
(T('Send a tr-eCard'), False, URL('default' , 'treecards.html')),
(T('Act for biodiversity'), False, URL('default' , 'otop_intro.html')),
(T('Full user guide'), False, URL('default' , 'full_guide.html')),
(T('My sponsorships'), False, URL('default' , 'sponsor_user_manage.html')),
(T('For Everyone'), False, None , [
(T('A view of all known life'), False, URL('default', 'introduction', extension=False)),
(T('Your name on the tree'), False, URL('default' , 'sponsor', extension=False)),
(T('Send a tr-eCard'), False, URL('default' , 'treecards', extension=False)),
(T('Act for biodiversity'), False, URL('default' , 'otop_intro', extension=False)),
(T('Full user guide'), False, URL('default' , 'full_guide', extension=False)),
(T('My sponsorships'), False, URL('default' , 'sponsor_user_manage', extension=False)),
]),

(T('For Education'), False, None , [
(T('Installations'), False, URL('education' , 'installations.html')),
(T('Display launcher'), False, URL('education' , 'museum_display_setup.html')),
(T('Educational materials'), False , URL('education' , 'educational_materials.html')),
(T('Screenshot tool'), False , URL('education' , 'screenshot_launcher.html')),
(T('Installations'), False, URL('education' , 'installations', extension=False)),
(T('Display launcher'), False, URL('education' , 'museum_display_setup', extension=False)),
(T('Educational materials'), False , URL('education' , 'educational_materials', extension=False)),
(T('Screenshot tool'), False , URL('education' , 'screenshot_launcher', extension=False)),
]),

(T('For Science'), False, None , [
(T('Work with us'), False, URL('default' , 'work_with_us.html')),
(T('Developer tools'), False , URL('developer' , 'index.html')),
(T('Popularity index'), False , URL('popularity' , 'index.html')),
(T('Public APIs'), False , URL('API','index.html')),
(T('Data sources'), False, URL('default' , 'data_sources.html')),
(T('Changelog'), False , URL('developer' , 'changelog.html')),
(T('Legacy trees'), False , URL('default' , 'tree_index.html')),
(T('Work with us'), False, URL('default' , 'work_with_us', extension=False)),
(T('Developer tools'), False , URL('developer' , 'index', extension=False)),
(T('Popularity index'), False , URL('popularity' , 'index', extension=False)),
(T('Public APIs'), False , URL('API','index', extension=False)),
(T('Data sources'), False, URL('default' , 'data_sources', extension=False)),
(T('Changelog'), False , URL('developer' , 'changelog', extension=False)),
(T('Legacy trees'), False , URL('default' , 'tree_index', extension=False)),
]),

(T('About us'), False, None , [
(T('Project timeline'), False , URL('default' , 'timeline.html') ),
(T('Endorsements'), False, URL('default' , 'endorsements.html')),
(T('About OneZoom'), False, URL('default' , 'about.html')),
(T('Donors'), False , URL('default' , 'donor_list.html') ),
(T('Team'), False, URL('default' , 'team.html')),
(T('FAQ'), False, URL('default' , 'FAQ.html')),
(T('Project timeline'), False , URL('default' , 'timeline', extension=False) ),
(T('Endorsements'), False, URL('default' , 'endorsements', extension=False)),
(T('About OneZoom'), False, URL('default' , 'about', extension=False)),
(T('Donors'), False , URL('default' , 'donor_list', extension=False) ),
(T('Team'), False, URL('default' , 'team', extension=False)),
(T('FAQ'), False, URL('default' , 'FAQ', extension=False)),
]),
]

Expand Down
2 changes: 2 additions & 0 deletions private/appconfig.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ url = https://www.sandbox.paypal.com
save_to_tmp_file_dir =

[general]
; Enable "automatic translations" behavior. Ignored unless is_testing is also set
; allow_translation_string_writing = 1

[images]
; * url_base: get thumbnail images from this source. If not
Expand Down
1 change: 1 addition & 0 deletions static/FinalOutputs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pics
img/*/
data/*
Binary file added static/FinalOutputs/data/dates_28585269.js.gz
Binary file not shown.
1 change: 1 addition & 0 deletions static/FinalOutputs/data/dates_28585326.js

Large diffs are not rendered by default.

Binary file added static/FinalOutputs/data/dates_28585326.js.gz
Binary file not shown.
Binary file added static/images/TourWithVideoLarge.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions tests/unit/test_controllers_default_sponsor.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,54 @@ def test_sponsor_renew(self):
self.assertEqual(str(out['all_row_categories'][2]['title']), 'Expired sponsorships')
self.assertEqual([r.OTT_ID for r in out['all_row_categories'][2]['rows']], [r.OTT_ID for r in rs])

def test_sponsor_renew_request(self):
email_1, user_1 = '[email protected]', '1_bettyunittestexamplecom'

def srr(user_identifier):
current.request.scheme = True
current.request.extension = 'html'
current.request.controller = 'default'
current.request.function = 'sponsor_renew_request'
current.request.vars.clear()
current.session.flash = None
current.globalenv['myconf']['smtp'] = dict(autosend_email=0)
if user_identifier:
current.request.vars['user_identifier'] = user_identifier
current.request.vars['_formname'] = 'default'
try:
out = default.sponsor_renew_request()
except HTTP as e:
return dict(
status=e.status,
location=e.headers.get('Location'),
flash=current.session.flash,
)
return dict(
status=current.response.status,
flash=current.session.flash,
form_errors=dict(out['form'].errors),
form_latest=dict(out['form'].latest),
)

# Empty form, no message
self.assertEqual(srr(None), dict(
status=200,
flash=None,
form_errors={},
form_latest={'user_identifier': None},
))
# Sumbit something, get told we'll send an e-mail in a redirect (not a 200)
self.assertEqual(srr(user_1), dict(
status=303,
location='/sponsor_renew_request',
flash='If the user %s exists in our database, we will send them an email' % user_1,
))
self.assertEqual(srr(email_1), dict(
status=303,
location='/sponsor_renew_request',
flash='If the user %s exists in our database, we will send them an email' % email_1,
))


if __name__ == '__main__':
import sys
Expand Down
3 changes: 2 additions & 1 deletion views/default/FAQ.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ <h4>Questions about the tree data</h4>
<ul uk-accordion>
<li>
<a class="uk-accordion-title" href="#">Q: I can't find my favourite species or group of species</a>
<div class="uk-accordion-content">A: Our database currently contains {{="{:,}".format(n_species)}} species, representing almost all known living species. Whilst to the best of our knowledge, ours is the most comprehensive tree of life explorer out there, there are still many things you won't find here. We do not show viruses such as COVID-19 because it is not known where to place them on the rest of the tree of life, and some question whether viruses count as living things at all. We do not show many extinct species at this time (so you won't find dinosaurs here yet). If the species you are searching for isn't there, it could also be because it is known by a different scientific (latin) name. It could be that the species you are looking for is a subspecies of a leaf that is on the tree. For example, {{=A('domestic dogs', _href="life.html/@Canis_lupus", url_encode=False)}} are a subspecies of wolf, so do not appear as a separate leaf on our tree - though you can actually search for the domestic dog on our tree and get to the grey wolf leaf, the same might not be true of other subspecies and certainly not for domestic breeds. Some commonly used names to describe groups of life (e.g. reptiles) don't correspond to a single clean location on the tree of life. To use a scientific expression, they are not 'monophyletic'. In the case of reptiles, crocodiles are more closely related to birds than they are to turtle. So it's not possible to cut a single branch from the tree and say that this branch is the reptiles - you'd either end up getting birds as well, or you'd be missing out some other reptiles. This means that 'reptiles' isn't really a single place on the tree and you can't currently search for it. Finally, there are some species that are so difficult to place on the tree that they have been temporarily omitted from the {{=A('Open Tree of Life', _href="http://opentreeoflife.org")}}, from where we obtain much of our information. For some popular groups, such as the {{=A('kinglet family', _href='https://tree.opentreeoflife.org/opentree/argus/@ott5846362')}} of birds (which includes the {{=A('goldcrest', _href=URL("default", "life.html", args=["@=3599889"], url_encode=False))}}, we have attempted to graft these back onto the OneZoom tree, but for some other groups, such as the {{=A('Nerillidae family of polychaete worms', _href="https://en.wikipedia.org/wiki/Nerillidae")}}, we have not. Basically, if you can find your species on the {{=A('Open Tree of Life browser', _href="https://tree.opentreeoflife.org/opentree")}}, it should be on the OneZoom tree. If you have exhausted all possibilities, we may be able to help if you email us.</div>
<div class="uk-accordion-content">A: Our database currently contains {{="{:,}".format(n_species)}} species, representing almost all known living species. Whilst to the best of our knowledge, ours is the most comprehensive tree of life explorer out there, there are still many things you won't find here. We do not show viruses such as COVID-19 because it is not known where to place them on the rest of the tree of life, and some question whether viruses count as living things at all. We do not show many extinct species at this time (so you won't find dinosaurs here yet).
If the species you are searching for isn't there, it could also be because it is known by a different scientific (latin) name. It could be that the species you are looking for is a subspecies of a leaf that is on the tree. For example, {{=A('domestic dogs', _href=URL("default", "life/@Canis_lupus", url_encode=False, extension=False))}} are a subspecies of wolf, so do not appear as a separate leaf on our tree - though you can actually search for the domestic dog on our tree and get to the grey wolf leaf, the same might not be true of other subspecies and certainly not for domestic breeds. Some commonly used names to describe groups of life (e.g. reptiles) don't correspond to a single clean location on the tree of life. To use a scientific expression, they are not 'monophyletic'. In the case of reptiles, crocodiles are more closely related to birds than they are to turtle. So it's not possible to cut a single branch from the tree and say that this branch is the reptiles - you'd either end up getting birds as well, or you'd be missing out some other reptiles. This means that 'reptiles' isn't really a single place on the tree and you can't currently search for it. Finally, there are some species that are so difficult to place on the tree that they have been temporarily omitted from the {{=A('Open Tree of Life', _href="http://opentreeoflife.org")}}, from where we obtain much of our information. For some popular groups, such as the {{=A('kinglet family', _href='https://tree.opentreeoflife.org/opentree/argus/@ott5846362')}} of birds (which includes the {{=A('goldcrest', _href=URL("default", "life/@=3599889", url_encode=False, extension=False))}}, we have attempted to graft these back onto the OneZoom tree, but for some other groups, such as the {{=A('Nerillidae family of polychaete worms', _href="https://en.wikipedia.org/wiki/Nerillidae")}}, we have not. Basically, if you can find your species on the {{=A('Open Tree of Life browser', _href="https://tree.opentreeoflife.org/opentree")}}, it should be on the OneZoom tree. If you have exhausted all possibilities, we may be able to help if you email us.</div>
</li>
<li>
<a class="uk-accordion-title" href="#">Q: The tree is wrong!</a>
Expand Down
Loading

0 comments on commit 78c851c

Please sign in to comment.