Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6f4a557
Modifying config files and parser
josenavas Feb 19, 2016
f65d6bf
Merge branch 'subdir-portals' of https://github.com/biocore/qiita int…
antgonza Feb 19, 2016
ff36f09
Addressing comments
josenavas Feb 19, 2016
17042b9
fixing some files!
antgonza Feb 19, 2016
f0271e8
Fixing parser
josenavas Feb 19, 2016
6bd9d31
Merge branch 'master' of https://github.com/biocore/qiita into subdir…
josenavas Feb 19, 2016
60c50e8
Merge branch 'subdir-portals' of https://github.com/biocore/qiita int…
antgonza Feb 19, 2016
a0ab325
update sitebase for portals
squirrelo Feb 19, 2016
23afbde
move to raw output
squirrelo Feb 19, 2016
b3fc0a1
addressing @squirrelo comments
antgonza Feb 19, 2016
e5bae74
update error_log
squirrelo Feb 19, 2016
71e8383
update list_studies
squirrelo Feb 19, 2016
de2b96b
fixing some files!
antgonza Feb 19, 2016
731d62c
Merge pull request #1649 from antgonza/subdir-portals-agp
josenavas Feb 19, 2016
65c1d8d
Merge pull request #1650 from squirrelo/portal-updates-1
josenavas Feb 19, 2016
d4e544a
Fixing form in error_log.html
josenavas Feb 19, 2016
9e28c90
Merge pull request #1651 from squirrelo/portal-updates-2
josenavas Feb 19, 2016
b7ea47e
Merge branch 'subdir-portals' of https://github.com/biocore/qiita int…
josenavas Feb 19, 2016
78bc774
Fixing various files
josenavas Feb 19, 2016
f4a1ce1
More files
josenavas Feb 19, 2016
9d0d57d
Fixing study description templates
josenavas Feb 19, 2016
31acb67
Merge pull request #1655 from josenavas/subdir-portals-misc
antgonza Feb 20, 2016
a10e4af
Fixing comments
josenavas Feb 20, 2016
427f866
Adding missing import
josenavas Feb 20, 2016
48094b8
Merge pull request #1656 from josenavas/subdir-portals-2
antgonza Feb 20, 2016
593dbee
Merge pull request #1654 from josenavas/portal-updates-2
antgonza Feb 20, 2016
4981f03
Merge pull request #1652 from antgonza/subdir-portals-agp-1
josenavas Feb 20, 2016
e02ec12
Merge pull request #1657 from josenavas/subdir-portals-study-desc-tem…
antgonza Feb 20, 2016
18fdd3a
Fixing merge conflict
josenavas Feb 23, 2016
a8f8271
Fixing link in list_studies
josenavas Feb 23, 2016
690106f
Adding setUp to TestSearchStudiesAJAX
josenavas Feb 23, 2016
afcd709
Adding a test to TestSearchStudiesAJAX with different portal
josenavas Feb 23, 2016
ff469b9
Changing url in email sent to the user
josenavas Feb 24, 2016
4689470
Fixing link in sitebase.html
josenavas Feb 24, 2016
bbe27ca
Fixing moi call in analysis
josenavas Feb 25, 2016
11372c8
Fixing login_url in webserver config
josenavas Feb 25, 2016
a55fb93
Merge branch 'subdir-portals-missing' of https://github.com/josenavas…
antgonza Feb 29, 2016
030f397
Merge pull request #1662 from josenavas/subdir-portals-missing
antgonza Feb 29, 2016
c23fcee
solving rest of issues
antgonza Mar 1, 2016
6c933fb
Merge pull request #1670 from antgonza/fixing-portals
josenavas Mar 1, 2016
8ab30b5
some more minor fixes
antgonza Mar 2, 2016
d1c5468
Merge pull request #1673 from antgonza/fixing-portals-1
josenavas Mar 2, 2016
14bc507
initial commit
antgonza Mar 30, 2016
3da8863
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
antgonza Mar 30, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion qiita_core/configuration_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ class ConfigurationManager(object):
The VAMPS URL
conf_fp : str
The filepath for the configuration file that is loaded
portal : str
The portal under the Qiita instance is running under
portal_dir : str
The portal subdirectory used in the URL
portal_fp : str
The filepath to the portal styling config file
plugin_launcher : str
Expand Down Expand Up @@ -161,7 +165,6 @@ def _get_main(self, config):
self.working_dir)
self.max_upload_size = config.getint('main', 'MAX_UPLOAD_SIZE')
self.require_approval = config.getboolean('main', 'REQUIRE_APPROVAL')
self.portal = config.get('main', 'PORTAL')
self.plugin_launcher = config.get('main', 'PLUGIN_LAUNCHER')

self.valid_upload_extension = [ve.strip() for ve in config.get(
Expand Down Expand Up @@ -240,3 +243,12 @@ def _get_vamps(self, config):

def _get_portal(self, config):
self.portal_fp = config.get('portal', 'PORTAL_FP')
self.portal = config.get('portal', 'PORTAL')
self.portal_dir = config.get('portal', 'PORTAL_DIR')
if self.portal_dir:
if not self.portal_dir.startswith('/'):
self.portal_dir = "/%s" % self.portal_dir
if self.portal_dir.endswith('/'):
self.portal_dir = self.portal_dir[:-1]
else:
self.portal_dir = ""
10 changes: 7 additions & 3 deletions qiita_core/support_files/config_test.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ BASE_DATA_DIR =
# Valid upload extension, comma separated. Empty for no uploads
VALID_UPLOAD_EXTENSION = fastq,fastq.gz,txt,tsv,sff,fna,qual

# Portal the site is working under
PORTAL = QIITA

# Script used for launching plugins
PLUGIN_LAUNCHER = qiita-plugin-launcher

Expand Down Expand Up @@ -144,5 +141,12 @@ URL = https://vamps.mbl.edu/mobe_workshop/getfile.php

# ----------------------------- Portal settings -----------------------------
[portal]

# Portal the site is working under
PORTAL = QIITA

# Portal subdirectory
PORTAL_DIR =

# Full path to portal styling config file
PORTAL_FP =
18 changes: 3 additions & 15 deletions qiita_db/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,27 +977,15 @@ def _build_mapping_file(self, samples, rename_dup_samples=False):
"""Builds the combined mapping file for all samples
Code modified slightly from qiime.util.MetadataMap.__add__"""
with qdb.sql_connection.TRN:
# query to get the latest qiime mapping file
sql = """SELECT filepath
FROM qiita.filepath
JOIN qiita.prep_template_filepath USING (filepath_id)
JOIN qiita.prep_template USING (prep_template_id)
JOIN qiita.filepath_type USING (filepath_type_id)
WHERE filepath_type = 'qiime_map'
AND artifact_id IN (SELECT *
FROM qiita.find_artifact_roots(%s))
ORDER BY filepath_id DESC LIMIT 1"""
_, fp = qdb.util.get_mountpoint('templates')[0]

all_ids = set()
to_concat = []
for aid, samps in viewitems(samples):
qdb.sql_connection.TRN.add(sql, [aid])
qm_fp = qdb.sql_connection.TRN.execute_fetchindex()[0][0]
qiime_map_fp = qdb.artifact.Artifact(
aid).prep_templates[0].qiime_map_fp

# Parse the mapping file
qm = qdb.metadata_template.util.load_template_to_dataframe(
join(fp, qm_fp), index='#SampleID')
qiime_map_fp, index='#SampleID')

# if we are not going to merge the duplicated samples
# append the aid to the sample name
Expand Down
15 changes: 10 additions & 5 deletions qiita_pet/handlers/analysis_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from qiita_db.logger import LogEntry
from qiita_db.reference import Reference
from qiita_core.util import execute_as_transaction
from qiita_core.qiita_settings import qiita_config

SELECT_SAMPLES = 2
SELECT_COMMANDS = 3
Expand Down Expand Up @@ -127,11 +128,13 @@ def post(self, analysis_id):
cmd_split = [x.split("#") for x in command_args]

moi_user_id = get_id_from_user(self.current_user.id)
moi_group = create_info(analysis_id, 'group', url='/analysis/',
parent=moi_user_id, store=True)
moi_group = create_info(
analysis_id, 'group', url='%s/analysis/' % qiita_config.portal_dir,
parent=moi_user_id, store=True)
moi_name = ("Creating %s... When finished, please click the 'Success' "
"link to the right" % analysis.name)
moi_result_url = '/analysis/results/%d' % analysis_id
moi_result_url = '%s/analysis/results/%d' % (qiita_config.portal_dir,
analysis_id)

submit(ctx_default, moi_group['id'], moi_name,
moi_result_url, run_analysis, analysis_id, cmd_split,
Expand Down Expand Up @@ -206,7 +209,8 @@ def post(self, analysis_id):
LogEntry.create('Runtime', "Couldn't remove analysis ID %d: %s" %
(analysis_id, e))

self.redirect(u"/analysis/show/?level=%s&message=%s" % (level, msg))
self.redirect(u"%s/analysis/show/?level=%s&message=%s"
% (qiita_config.portal_dir, level, msg))


class ShowAnalysesHandler(BaseHandler):
Expand Down Expand Up @@ -271,7 +275,8 @@ def post(self):
LogEntry.create('Runtime', "Couldn't remove analysis ID %d: %s" %
(analysis_id, e))

self.redirect(u"/analysis/show/?level=%s&message=%s" % (level, msg))
self.redirect(u"%s/analysis/show/?level=%s&message=%s"
% (qiita_config.portal_dir, level, msg))


class ResultsHandler(StaticFileHandler, BaseHandler):
Expand Down
24 changes: 12 additions & 12 deletions qiita_pet/handlers/auth_handlers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

from tornado.escape import url_escape, json_encode
from tornado.web import HTTPError

Expand Down Expand Up @@ -46,19 +44,21 @@ def post(self):
try:
send_email(username, "QIITA: Verify Email Address", "Please "
"click the following link to verify email address: "
"%s/auth/verify/%s?email=%s"
% (qiita_config.base_url, info['user_verify_code'],
url_escape(username)))
"%s/%s/auth/verify/%s?email=%s"
% (qiita_config.base_url, qiita_config.portal_dir,
info['user_verify_code'], url_escape(username)))
except:
msg = ("Unable to send verification email. Please contact the "
"qiita developers at <a href='mailto:qiita-help"
"@gmail.com'>qiita-help@gmail.com</a>")
self.redirect(u"/?level=danger&message=" + url_escape(msg))
self.redirect(u"%s/?level=danger&message=%s"
% (qiita_config.portal_dir, url_escape(msg)))
return
self.redirect(u"/")
self.redirect(u"%s/" % qiita_config.portal_dir)
else:
error_msg = u"?error=" + url_escape(msg)
self.redirect(u"/auth/create/" + error_msg)
self.redirect(u"%s/auth/create/%s"
% (qiita_config.portal_dir, error_msg))


class AuthVerifyHandler(BaseHandler):
Expand All @@ -77,7 +77,7 @@ def get(self, code):
class AuthLoginHandler(BaseHandler):
"""user login, no page necessary"""
def get(self):
self.redirect("/")
self.redirect("%s/" % qiita_config.portal_dir)

@execute_as_transaction
def post(self):
Expand All @@ -91,7 +91,7 @@ def post(self):
if "auth/" not in self.request.headers['Referer']:
nextpage = self.request.headers['Referer']
else:
nextpage = "/"
nextpage = "%s/" % qiita_config.portal_dir

msg = ""
# check the user level
Expand All @@ -109,7 +109,7 @@ def post(self):
# means DB not available, so set maintenance mode and failover
r_client.set("maintenance", "Database connection unavailable, "
"please try again later.")
self.redirect("/")
self.redirect("%s/" % qiita_config.portal_dir)
return

# Check the login information
Expand Down Expand Up @@ -141,4 +141,4 @@ class AuthLogoutHandler(BaseHandler):
"""Logout handler, no page necessary"""
def get(self):
self.clear_cookie("user")
self.redirect("/")
self.redirect("%s/" % qiita_config.portal_dir)
8 changes: 5 additions & 3 deletions qiita_pet/handlers/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from qiita_ware.context import submit
from qiita_ware.dispatchable import create_raw_data, copy_raw_data
from qiita_core.util import execute_as_transaction
from qiita_core.qiita_settings import qiita_config
from qiita_db.util import get_mountpoint
from qiita_db.metadata_template.prep_template import PrepTemplate

Expand All @@ -23,7 +24,7 @@ def get(self, job_id):
# TODO: something smart
pass

self.redirect('/')
self.redirect('%s/' % qiita_config.portal_dir)


class CreateRawData(BaseHandler):
Expand Down Expand Up @@ -82,5 +83,6 @@ def post(self):
self.render('compute_wait.html',
job_id=job_id, title='Adding raw data',
completion_redirect=(
'/study/description/%s?top_tab=prep_template_tab'
'&sub_tab=%s' % (study_id, pt_id)))
'%s/study/description/%s?top_tab=prep_template_tab'
'&sub_tab=%s'
% (qiita_config.portal_dir, study_id, pt_id)))
11 changes: 7 additions & 4 deletions qiita_pet/handlers/study_handlers/edit_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from wtforms import (Form, StringField, SelectField, SelectMultipleField,
TextAreaField, validators)

from qiita_core.qiita_settings import qiita_config
from qiita_db.study import Study, StudyPerson
from qiita_db.util import get_timeseries_types, get_environmental_packages
from qiita_db.exceptions import QiitaDBUnknownIDError
Expand Down Expand Up @@ -261,18 +262,20 @@ def post(self, study=None):
the_study.title = study_title
the_study.info = info

msg = ('Study <a href="/study/description/%d">%s</a> '
msg = ('Study <a href="%s/study/description/%d">%s</a> '
'successfully updated' %
(the_study.id, form_data.data['study_title'][0]))
(qiita_config.portal_dir, the_study.id,
form_data.data['study_title'][0]))
else:
# create the study
# TODO: Fix this EFO once ontology stuff from emily is added
the_study = Study.create(self.current_user, study_title,
efo=[1], info=info)

msg = ('Study <a href="/study/description/%d">%s</a> '
msg = ('Study <a href="%s/study/description/%d">%s</a> '
'successfully created' %
(the_study.id, form_data.data['study_title'][0]))
(qiita_config.portal_dir, the_study.id,
form_data.data['study_title'][0]))

# Add the environmental packages, this attribute can only be edited
# if the study is not public, otherwise this cannot be changed
Expand Down
Loading