Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 20 additions & 5 deletions qiita_db/support_files/patches/python_patches/66.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
# August 6, 2018
# Create parameters for the ssh/scp remote file upload commands


from json import loads, dumps

from qiita_db.sql_connection import TRN
from qiita_db.software import Software, Command
from qiita_db.exceptions import (QiitaDBError, QiitaDBDuplicateError)
from qiita_db.util import convert_to_id
from qiita_db.study import Study
from re import sub

# August 31, 2018
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch needs to be moved to its own file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do this in my PR as I'm fixing conflicts; however, in the past we have decided to have only one patch per release cycle ... thus; the idea of having in the same patch

# Strip any UTF-8 characters that are not also printable ASCII characters
# from study titles. As some analysis packages cannot interpret UTF-8
# characters, it becomes important to remove them from study titles, as
# they are used as metadata/identifiers when creating new analyses.

# insert new status_types into list, or replace w/a call to an appropriate
# method.
status_types = ['awaiting_approval', 'sandbox', 'private', 'public']

for status_type in status_types:
for study in Study.get_by_status(status_type):
new_title = sub(r'[^\x20-\x7E]+', '', study.title)
if new_title != study.title:
study.title = new_title


# August 6, 2018
# Create parameters for the ssh/scp remote file upload commands
# Copied from patch 58.py. Couldn't import due to how patching system works
def create_command(software, name, description, parameters, outputs=None,
analysis_only=False):
Expand Down
13 changes: 10 additions & 3 deletions qiita_pet/templates/edit_study.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends sitebase.html %}
{% block head %}
<script type="text/javascript" src="{% raw qiita_config.portal_dir %}/static/vendor/js/jquery.validate.min.js"></script>
<script type = "text/javascript"
src = "{% raw qiita_config.portal_dir %}/static/vendor/js/jquery.validate.min.js">
</script>
<style>
.custom-combobox {
position: relative;
Expand Down Expand Up @@ -32,7 +34,9 @@
var title = $(this).val();
// removing any duplicated whitespaces
title = title.replace(/ +(?= )/g, '');
// removing wite spaces from the front of the text
//remove all utf-8 encoded characters that are not also printable ASCII characters.
title = title.replace(/[^\x20-\x7E]+/g, "");
// removing white spaces from the front of the text
$(this).val(title.trimLeft());
});
$("#create_study").validate({
Expand Down Expand Up @@ -156,8 +160,11 @@ <h3>
{% if form_item.label.text == 'Environmental Packages' %}
{% set kwargs['size'] = len(form_item.choices) %}
{% set additional_info = 'You can select multiple entries by control-clicking (mac: command-clicking)' %}
{% elif form_item.label.text == 'Principan Investigator'%}
{% elif form_item.label.text == 'Principal Investigator'%}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

{% set kwargs['class_'] = kwargs['class_'] + ' chzn-select' %}
{% elif form_item.label.text == 'Study Title'%}
{% set additional_info = 'Study titles may only contain ASCII characters' %}

{% end %}
<tr>
<td width="20%">{% raw form_item.label %} <br /> <small>{{additional_info}}</small></td>
Expand Down