Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 #1437

Draft
wants to merge 86 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
54e80de
Remove pysqlite from requirements.txt
mauzey1 May 10, 2019
4770817
Run 2to3 on all Python code
mauzey1 May 10, 2019
0d9354d
Remove periods from imports in the installation Python scripts
mauzey1 May 10, 2019
50a079b
Turn values into strings for ConfigParser
mauzey1 May 10, 2019
5bdde50
Fix indent
mauzey1 May 10, 2019
f5568f8
Remove importing 'join' and 'replace' from module 'string'
mauzey1 May 10, 2019
925d191
Add changes from ESGF devel
mauzey1 May 24, 2019
c26fd56
Replace StringIO.StringIO with io.StringIO
mauzey1 May 24, 2019
7ca5774
Changed ConfigParser.ConfigParser to configparser.ConfigParser
mauzey1 May 24, 2019
e227772
Add "from __future__ import unicode_literals" back to files
mauzey1 May 24, 2019
76498ad
Remove extra line
mauzey1 May 24, 2019
c7473e8
Fix exception and print for Python 3.
mauzey1 May 29, 2019
9ee5e32
Change 'from . import cog.views' to 'import cog.views'
mauzey1 Jun 3, 2019
6348763
Change str and unicode to bytes and text
mauzey1 Jun 4, 2019
6944ad1
Use psycopg2 >=2.7 for Python 3.7 support due to use of 'async' as a …
mauzey1 Jun 7, 2019
7ea2827
Updated packages in requirements.txt; updated Django to 2.2
mauzey1 Jun 7, 2019
6c7253b
change django.core.urlresolvers to django.urls
mauzey1 Jun 7, 2019
15f8e2a
change MIDDLEWARE_CLASSES to MIDDLEWARE in settings.py
mauzey1 Jun 8, 2019
78be6c0
Remove parentheses from User.is_authenticated and User.is_anonymous
mauzey1 Jun 8, 2019
9c002d1
Add on_delete=models.CASCADE to ForeignKey calls
mauzey1 Jul 1, 2019
a426c00
Remove include function for admin URLs
mauzey1 Jul 27, 2019
85ba1f7
Get login and logout from django.contrib.auth
mauzey1 Jul 27, 2019
70983af
Middleware now accepts get_response argument
mauzey1 Jul 27, 2019
81c5863
Replace login and logout with LoginView and LogoutView
mauzey1 Jul 31, 2019
abcc805
Put ignore-case expression (?i) at the end of the regex pattern
mauzey1 Aug 1, 2019
32a9bbc
Replace name of field with queryset=Project.objects.all()
mauzey1 Aug 1, 2019
c1c8896
Replace string decode
mauzey1 Aug 1, 2019
40f78d9
Merge remote-tracking branch 'esgf/devel' into python_3
mauzey1 Aug 1, 2019
7a2cfba
Use floor division when dividing offset by limit when calculating the…
mauzey1 Aug 6, 2019
94ff176
Ensure the project URL parameter is available to determine correct se…
nathanlcarlson Oct 21, 2019
887cd45
User the default search location as the index node for wget scripts
nathanlcarlson Oct 21, 2019
3bc58cd
Use the default search url for globus file searches
nathanlcarlson Oct 21, 2019
ec8d691
Use project specific search path for metadata displays
nathanlcarlson Oct 21, 2019
2be8a22
Properly spell 'django' in import
nathanlcarlson Oct 21, 2019
d7c9e5b
Use default search path for searching and displaying files
nathanlcarlson Oct 21, 2019
f417bfc
Merge pull request #1420 from EarthSystemCoG/index_node_usage
sashakames Oct 23, 2019
895c7da
Complete the revert to using the transfer api client
nathanlcarlson Oct 24, 2019
cd93efb
merge EarthSystemCoG:devel
mauzey1 Nov 25, 2019
2840e59
Add parentheses to print statements
mauzey1 Nov 25, 2019
0d21145
Update requirements.txt package versions
mauzey1 Nov 25, 2019
88a3b22
Merge branch 'devel' of github.com:EarthSystemCoG/COG into devel
mauzey1 Nov 26, 2019
ed5da0f
Update Globus downloads to use Globus SDK
mauzey1 Nov 13, 2019
b38736d
Merge pull request #1423 from mauzey1/globus-sdk-new2
mauzey1 Dec 3, 2019
96b8a76
Merge branch 'devel' of github.com:EarthSystemCoG/COG into devel
mauzey1 Dec 5, 2019
25e19c1
Merge changes from devel
mauzey1 Dec 5, 2019
467a28e
Apply changes for urllib in Python 3. Change django.core.urlresolver…
mauzey1 Dec 11, 2019
8950f7d
Fix import of views_status in __init__.py
mauzey1 Dec 11, 2019
735d351
cherry pick soay citation update
sashakames Dec 12, 2019
95c268a
Update reading of 'x-cera-rc' header value when displaying citations.
mauzey1 Dec 12, 2019
7ac4442
Merge branch 'v3.15.2-patch1' of https://github.com/sashakames/COG in…
sashakames Dec 12, 2019
f0726ce
up v num
sashakames Dec 12, 2019
9176e31
Merge branch 'v3.15.2-patch1' into devel
sashakames Dec 13, 2019
1d75ac6
Merge branch 'master' into v3.15.2-patch1
sashakames Dec 13, 2019
2179d0c
Merge branch 'devel' of https://github.com/EarthSystemCoG/COG into me…
sashakames Dec 13, 2019
3d12704
Update views_globus
mauzey1 Dec 13, 2019
fdb6567
Fix wget script URL so that it has a '?' even if there are no shards …
mauzey1 Dec 13, 2019
53e8027
Merge branch 'devel' of github.com:EarthSystemCoG/COG into python_3
mauzey1 Dec 13, 2019
b1d0dd4
Merge branch 'devel' of github.com:EarthSystemCoG/COG into devel
mauzey1 Dec 13, 2019
a3cba24
Merge branch 'devel' of github.com:EarthSystemCoG/COG into python_3
mauzey1 Dec 13, 2019
b1b796c
Comment out esgfpid in requirements.txt
mauzey1 Dec 20, 2019
3ff3e5f
When adding pages or links, make label default to the title if the la…
mauzey1 Jan 15, 2020
f42922d
If the constraints field is blank when configuring search, then store…
mauzey1 Jan 29, 2020
a7b03e0
Revert "Use default search path for searching and displaying files"
mauzey1 Mar 12, 2020
740f8b7
Revert "Use project specific search path for metadata displays"
mauzey1 Mar 12, 2020
b3f5a0e
Revert "Use the default search url for globus file searches"
mauzey1 Mar 12, 2020
9a02f72
Revert "User the default search location as the index node for wget s…
mauzey1 Mar 12, 2020
b946a56
Revert "Ensure the project URL parameter is available to determine co…
mauzey1 Mar 12, 2020
ada3121
Merge pull request #1 from mauzey1/python_3_revert_index_node_usage
mauzey1 Mar 13, 2020
b024cb7
Revert "Fix wget script URL so that it has a '?' even if there are no…
mauzey1 Mar 19, 2020
3a324b0
Merge branch 'v3.15.2-patch1' into python_3_revert_index_node_usage
sashakames Apr 20, 2020
d6bd44f
added instruction
sashakames Apr 22, 2020
fccb412
Merge branch 'python_3' of https://github.com/mauzey1/COG into python_3
sashakames May 21, 2020
2154fa4
Merge pull request #2 from EarthSystemCoG/python_3
mauzey1 Jul 15, 2020
b84bbbf
Merge pull request #1431 from mauzey1/python_3
sashakames Sep 17, 2020
814b711
patch for pid/handles
sashakames Jan 14, 2021
607a0de
change url
sashakames Feb 2, 2021
da55d60
Merge branch 'fixsrvname' into python_3
sashakames Feb 2, 2021
6bfd0a9
Merge branch 'python_3' of https://github.com/EarthSystemCoG/COG into…
sashakames Feb 2, 2021
18ab9d1
updates for a 4.0.1
sashakames Feb 4, 2021
66e3b3b
up v num
sashakames Feb 4, 2021
29721cf
fix 3/# character issue
sashakames Feb 25, 2021
e156cf1
permit missing license without breaking
sashakames Feb 7, 2022
ce5e027
bump Django version
sashakames Feb 7, 2022
fdc9e8c
disable redirects via next=
sashakames Feb 15, 2022
296e918
readme
sashakames Feb 16, 2022
cdcb7b2
ensure user detail not shown to others
sashakames May 18, 2022
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
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
What is CoG?
============
# What is CoG?

CoG is a multi-institutional project that seeks to examine, within the Earth sciences,
the organizational characteristics of community software projects and to create software infrastructure
Expand All @@ -12,24 +11,25 @@ and that exposing those characteristics and linking them is a way to make a comp
The CoG project created the CoG environment - this website - as a way of promoting good governance across numerous projects
and organizations in the Earth system sciences. Its structure encourages information sharing among projects, transparency and trust.

For more information, visit: http://earthsystemcog.org/
For more information, visit: http://esgf.github.io/COG

Manual CoG update
-----------------
## Recent Updates

```
cd /usr/local/cog/cog_install
git fetch
git checkout v3.15.4 # or master, devel, etc.
/etc/cog-wsgi-8889/apachectl restart # for ESGF > v4.0.0
# previous versions restart node: esg-node restart
```
### v4.0.3

Latest release: v3.15.4
-----------------------
* Drop processing of use of next=url in add user query string.

- Add link to clear data cart to appear on pages that import the "middle navbar"
### v4.0.2
* Bug fix for Show Citation (missing data from API causes all information not to display)

Previous updates
## Python3 Update

This is v4.0.3 of CoG that supports Python3 and Django 2.2.24. Given that this Django 2.2 version has run in LLNL production for over eight months now, it is time that we release this version of COG as the master branch. We strongly encourage all sites to upgrade their deployments to this version.

The last v3.x version of CoG running with Python2 is preserved for legacy. This version is still needed to create the cogdb database (see below) for a standard legacy ESGF deployment using the Ansible playbooks (although a Postgres >9.5 supported version may be forthcoming....).

## Updating CoG

Use the Ansible playbook from the following branch: `python3_cog` - See https://esgf.github.io/esgf-ansible for instructions on how to run the playbooks.
The installation must be performed on a server that already has the cogdb deployed to PostgreSQL. In other words, in order to install CoG v4 from scratch, you must first run the latest Ansible playbook for ESGF, which will deploy CoG v3.15 (Python2) and create the cogdb database. Then, run the `python3_cog` branch playbook to setup CoG. Note that this installation will create a distinct Python3 conda environment for which to run the CoG service in mod_wsgi_express `py3_cog`. The previous `cog` environment will still be present, but is no longer used (and could be safely deleted).

- Updates to templates for help information in preparation for the retirement of the CU CoG site.
16 changes: 8 additions & 8 deletions apache/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")

# print debugging information
print 'Using Python version: %s' % sys.version
print 'Using Python path: %s' % sys.path
print 'PYTHONPATH=%s' % os.environ.get('PYTHONPATH', None)
print 'LD_LIBRARY_PATH=%s' % os.environ.get('LD_LIBRARY_PATH', None)
print 'SSL_CERT_DIR=%s' % os.environ.get('SSL_CERT_DIR', None)
print 'SSL_CERT_FILE=%s' % os.environ.get('SSL_CERT_FILE', None)
print('Using Python version: %s' % sys.version)
print('Using Python path: %s' % sys.path)
print('PYTHONPATH=%s' % os.environ.get('PYTHONPATH', None))
print('LD_LIBRARY_PATH=%s' % os.environ.get('LD_LIBRARY_PATH', None))
print('SSL_CERT_DIR=%s' % os.environ.get('SSL_CERT_DIR', None))
print('SSL_CERT_FILE=%s' % os.environ.get('SSL_CERT_FILE', None))

try:
application = get_wsgi_application()
print 'WSGI without exception'
print('WSGI without exception')
except Exception:
print 'handling WSGI exception'
print('handling WSGI exception')
# Error loading applications
if 'mod_wsgi' in sys.modules:
traceback.print_exc()
Expand Down
2 changes: 1 addition & 1 deletion cog/config/search/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from config_project_search import SearchConfigParser
from .config_project_search import SearchConfigParser
14 changes: 7 additions & 7 deletions cog/config/search/config_project_search.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import sys, os, ConfigParser
import sys, os, configparser
from django.conf import settings
from cog.models import Project, SearchGroup, SearchFacet
from cog.utils import str2bool
Expand All @@ -15,7 +15,7 @@ def __init__(self, project):
def _getConfigParser(self):

# read project configuration
configParser = ConfigParser.RawConfigParser()
configParser = configparser.RawConfigParser()
# must set following line explicitly to preserve the case of configuration keys
configParser.optionxform = str

Expand All @@ -25,7 +25,7 @@ def _getConfigParser(self):
def write(self):
'''Writes the project search configuration to the file $COG_CONFIG_DIR/projects/<project_short_name>/search.cfg'''

print 'Writing search configuration for project=%s' % self.project.short_name
print('Writing search configuration for project=%s' % self.project.short_name)

# load project search profile
project = Project.objects.get(short_name=self.project.short_name)
Expand Down Expand Up @@ -66,23 +66,23 @@ def write(self):
def read(self):
'''Reads the project search configuration from the file $COG_CONFIG_DIR/projects/<project_short_name>/search.cfg'''

print 'Reading search configuration for project=%s' % self.project.short_name
print('Reading search configuration for project=%s' % self.project.short_name)

# load project search profile
project = Project.objects.get(short_name=self.project.short_name)
search_profile = project.searchprofile

# remove existing groups of facets
for group in search_profile.groups.all():
print 'Deleting search group=%s' % group
print('Deleting search group=%s' % group)
group.delete()

# read project configuration
projConfig = self._getConfigParser()
try:
projConfig.read( self.config_file_path )
except Exception as e:
print "Configuration file %s not found" % self.config_file_path
print("Configuration file %s not found" % self.config_file_path)
raise e

# loop over configuration sections
Expand Down Expand Up @@ -110,7 +110,7 @@ def read(self):

for option in projConfig.options(section):
value = projConfig.get(section, option)
print section, option, value
print(section, option, value)
parts = value.split("|")
facet_order = int(option)
facet_key = parts[0]
Expand Down
2 changes: 1 addition & 1 deletion cog/db_migrations/django_openid_auth/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('claimed_id', models.TextField(unique=True, max_length=2047)),
('display_id', models.TextField(max_length=2047)),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
],
),
]
20 changes: 10 additions & 10 deletions cog/forms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from forms_image import *
from forms_account import *
from forms_bookmarks import *
from forms_governance import *
from forms_others import *
from forms_post import *
from forms_project import *
from forms_aboutus import *
from forms_search import *
from forms_access_control import *
from .forms_image import *
from .forms_account import *
from .forms_bookmarks import *
from .forms_governance import *
from .forms_others import *
from .forms_post import *
from .forms_project import *
from .forms_aboutus import *
from .forms_search import *
from .forms_access_control import *
4 changes: 2 additions & 2 deletions cog/forms/forms_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def validate_username(form, user_id):

# once the openid is validated, choose the closest possible username
_username = createUsername(username)
print 'Created username=%s from=%s' % (_username, username)
print('Created username=%s from=%s' % (_username, username))
cleaned_data['username'] = _username # override form data
else:
# django will automatically check that the username is unique in the CoG database
Expand All @@ -304,6 +304,6 @@ def validate_field(form, field_name, field_value):
def validate_ascii(form, field_name, field_value):
if field_value:
try:
field_value.decode('ascii')
field_value.encode('ascii')
except (UnicodeDecodeError, UnicodeEncodeError):
form._errors[field_name] = form.error_class(["'%s' contains invalid characters." % field_name])
2 changes: 1 addition & 1 deletion cog/forms/forms_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ def clean(self):
self._errors["image"] = self.error_class(["Image size exceeds the maximum allowed."])
except OSError as e:
# image not existing on disk
print e
print(e)

return self.cleaned_data
4 changes: 2 additions & 2 deletions cog/forms/forms_others.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ def clean(self):

file_ext = str(os.path.splitext(thefile.name)[1])
mime_type = magic.from_buffer(thefile.read(1024), mime=True)
print "Validating file extension=%s, mime type=%s" % (file_ext, mime_type)
print("Validating file extension=%s, mime type=%s" % (file_ext, mime_type))
if not file_ext:
self._errors["file"] = self.error_class(["File name must have an extension."])
elif file_ext.lower() not in VALID_MIME_TYPES.keys():
elif file_ext.lower() not in list(VALID_MIME_TYPES.keys()):
self._errors["file"] = self.error_class(["File extension %s is not supported." % file_ext])
elif mime_type not in VALID_MIME_TYPES[file_ext.lower()]:
self._errors["file"] = self.error_class(["File extension %s does not match its valid mime type." %
Expand Down
9 changes: 8 additions & 1 deletion cog/forms/forms_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def clean(self):
# validate "topic"
# cannot set both 'topic' and 'newtopic'
if topic and newtopic:
errmsg = u"Please either choose an existing topic OR create a new one"
errmsg = "Please either choose an existing topic OR create a new one"
self._errors["topic"] = self.error_class([errmsg])
del cleaned_data["topic"]
del cleaned_data["newtopic"]
Expand All @@ -152,6 +152,13 @@ def clean(self):

cleaned_data["topic"] = topic

# check if the 'label' field is set for hyperlink and page posts
# if 'label' is blank, then fill the field with the first 28 characters of 'title'
if type == Post.TYPE_PAGE or type == Post.TYPE_HYPERLINK:
label = cleaned_data["label"]
if label is None:
cleaned_data["label"] = cleaned_data["title"][:28]

# prevent XSS on fields 'title', 'label', 'newtopic'
for key in ["title", "label", "newtopic"]:
if key in cleaned_data:
Expand Down
10 changes: 5 additions & 5 deletions cog/forms/forms_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class ProjectForm(ModelForm):
# define the widget for parent/peer selection so we can set the styling. The class is set to .selectfilter and its
# styles are controlled in cogstyle.css

parents = forms.ModelMultipleChoiceField("parents", required=False,
parents = forms.ModelMultipleChoiceField(queryset=Project.objects.all(), required=False,
widget=forms.SelectMultiple(attrs={'size': '20',
'class': 'selectprojects'}))
peers = forms.ModelMultipleChoiceField("peers", required=False,
peers = forms.ModelMultipleChoiceField(queryset=Project.objects.all(), required=False,
widget=forms.SelectMultiple(attrs={'size': '20',
'class': 'selectprojects'}))
# filtering of what is see in the form is done down below.
Expand Down Expand Up @@ -99,7 +99,7 @@ def clean_long_name(self):

# check for non-ascii characters
try:
long_name.decode('ascii')
long_name.encode('ascii')
except (UnicodeDecodeError, UnicodeEncodeError):
raise forms.ValidationError("Project long name contains invalid non-ASCII characters")
return long_name
Expand Down Expand Up @@ -156,7 +156,7 @@ def clean(self):
features = self.cleaned_data.get('software_features')
if not hasText(features):
self._errors["software_features"] = self.error_class(["'SoftwareFeatures' must not be empty."])
print 'error'
print('error')
return self.cleaned_data


Expand All @@ -174,7 +174,7 @@ class ProjectTagForm(ModelForm):
# form constructor in views_project.py

# field['tags'] is the list of preexisting tags
tags = forms.ModelMultipleChoiceField("tags", required=False,
tags = forms.ModelMultipleChoiceField(queryset=Project.objects.all(), required=False,
widget=forms.SelectMultiple(attrs={'size': '7'}))

# override __init__ method to change the queryset for 'tags'
Expand Down
7 changes: 6 additions & 1 deletion cog/forms/forms_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ def clean_url(self):
return clean_url_field(self, 'url')

def clean_constraints(self):
return clean_url_field(self, 'constraints')
# if no constraints are found, then return an empty string
data = self.cleaned_data['constraints']
if data is None:
return ''
else:
return clean_url_field(self, 'constraints')


class SearchFacetForm(ModelForm):
Expand Down
2 changes: 1 addition & 1 deletion cog/forms/forms_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def validate_image(form, field_name):
# validate image header
try:
image_type = imghdr.what(image)
print 'Validating image header: detected image type=%s' % image_type
print('Validating image header: detected image type=%s' % image_type)
if image_type is None:
form._errors[field_name] = form.error_class(["Invalid image type: %s" % image_type])
except Exception as e:
Expand Down
20 changes: 10 additions & 10 deletions cog/installation/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

'''

import ConfigParser
import StringIO
import configparser
import io
import collections
import logging
import os
import time
from django.utils.crypto import get_random_string

from constants import (SECTION_DEFAULT, COG_SECTION_DEFAULT, SECTION_ESGF, SECTION_EMAIL,
from .constants import (SECTION_DEFAULT, COG_SECTION_DEFAULT, SECTION_ESGF, SECTION_EMAIL,
ESGF_PROPERTIES_FILE, ESGF_PASSWORD_FILE,
IDP_WHITELIST, KNOWN_PROVIDERS, PEER_NODES,
DEFAULT_PROJECT_SHORT_NAME)
Expand Down Expand Up @@ -59,7 +59,7 @@ def _readCogConfig(self):
'''Method that reads an existing COG configuration file, or create a new one if not existing.'''

# initialize COG configuration file
self.cogConfig = ConfigParser.ConfigParser(allow_no_value=True,
self.cogConfig = configparser.ConfigParser(allow_no_value=True,
dict_type=collections.OrderedDict)
# must set following line explicitly to preserve the case of configuration keys
self.cogConfig.optionxform = str
Expand All @@ -79,7 +79,7 @@ def _readCogConfig(self):
logging.info("Configuration file: %s not found, will create new one" % CONFIGFILEPATH )

except Exception as e:
print e
print(e)
logging.error("Error reading configuration file: %s" % CONFIGFILEPATH)
logging.error(e)

Expand All @@ -88,7 +88,7 @@ def _readEsgfConfig(self):
'''Method that reads local parameters from ESGF configuration file esgf.properties.'''

# read ESGF configuration file ($esg_config_dir/esgf.properties), if available
self.esgfConfig = ConfigParser.ConfigParser()
self.esgfConfig = configparser.ConfigParser()
try:
self.esgfConfig.read(ESGF_PROPERTIES_FILE)
except IOError:
Expand All @@ -103,7 +103,7 @@ def _readEsgfConfig(self):
with open(ESGF_PROPERTIES_FILE, 'r') as f:
# transform Java properties file into python configuration file: must prepend a section
config_string = '[%s]\n' % SECTION_DEFAULT + f.read()
config_file = StringIO.StringIO(config_string)
config_file = io.StringIO(config_string)
self.esgfConfig.readfp(config_file)
logging.info("Read ESGF configuration parameters from file: %s" % ESGF_PROPERTIES_FILE)

Expand Down Expand Up @@ -168,7 +168,7 @@ def _setupConfig(self):
# default search service URL, before any project customization
self._safeSet('DEFAULT_SEARCH_URL','http://%s/esg-search/search/' % hostName)
# interval between updates of user's projects, during user session
self._safeSet('MY_PROJECTS_REFRESH_SECONDS', 3600)
self._safeSet('MY_PROJECTS_REFRESH_SECONDS', '3600')
# optional number of days after which password expire
self._safeSet('PWD_EXPIRATION_DAYS','0')
# optional top-level URL to redirect user registration (no trailing '/')
Expand All @@ -188,13 +188,13 @@ def _setupConfig(self):
# PEER_NODES = /esg/config/esgf_cogs.xml
self._safeSet('PEER_NODES', PEER_NODES)
# option to send SESSION and CSRF cookies via SSL only - requires full SSL-encrypted site
self._safeSet('PRODUCTION_SERVER', True)
self._safeSet('PRODUCTION_SERVER', 'True')
# ESGF software stack version
esgfVersion = self._safeGet("version", default=None)
if esgfVersion:
self._safeSet('ESGF_VERSION', esgfVersion, override=True)
# option to disable CAPTCHA for creating account in automatic testing
self._safeSet('USE_CAPTCHA', True)
self._safeSet('USE_CAPTCHA', 'True')


#[ESGF]
Expand Down
2 changes: 1 addition & 1 deletion cog/installation/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _createObjects(self):
except ObjectDoesNotExist:
site = Site.objects.create(name=idpHostname, domain=idpHostname)
idpPeerSite = PeerSite.objects.create(site=site, enabled=True)
print '\tCreated IdP Peer site: %s with enabled=%s' % (idpPeerSite, idpPeerSite.enabled)
print('\tCreated IdP Peer site: %s with enabled=%s' % (idpPeerSite, idpPeerSite.enabled))


def _getRootAdminPassword(self):
Expand Down
Loading