Skip to content

Commit

Permalink
enable categories again in the view, but allow for disabling categori…
Browse files Browse the repository at this point in the history
…es by setting them empty in the settings. Also fix a sorting issue where names sometimes had whitespace in front of their names
  • Loading branch information
Jens Timmerman committed May 11, 2016
1 parent 2534fe6 commit 2c2a203
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name='django-wayf',
version='0.1',
version='0.2.0',
packages=find_packages(),
include_package_data=True,
license='GPL v3',
Expand Down
2 changes: 1 addition & 1 deletion wayf/templates/idp_dropdown.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% for category, insts in idplist %}
<!--optgroup label="{{ category.name }}"-->
<optgroup label="{{ category.name }}">
{% for inst in insts %}
{% ifequal inst.id selected.id %}
<option value="{{ inst.id }}" selected="true">{{ inst.name }}</option>
Expand Down
13 changes: 9 additions & 4 deletions wayf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ def getIdpsByCategory(self, lang=None, exclude=None):

idps = []

# if no valid categories are found, return all idp's
if not validcats:
catidps = self.getEntities()
return [('institutions', catidps)]

for category in cats:
catidps = sorted(self.getCategoryIdps(category))
idps.append(map(lambda x: {
Expand Down Expand Up @@ -253,13 +258,13 @@ def __init__(self,el):
# Get the institution's name
try:
for name in self.el.Organization.OrganizationDisplayName:
self.name[name.get('{http://www.w3.org/XML/1998/namespace}lang')] = name.text
self.name[name.get('{http://www.w3.org/XML/1998/namespace}lang')] = name.text.strip()
except:
self.name = {'en': "no name"}

try:
for url in self.el.Organization.OrganizationURL:
self.url[url.get('{http://www.w3.org/XML/1998/namespace}lang')] = url.text
self.url[url.get('{http://www.w3.org/XML/1998/namespace}lang')] = url.text.strip()
except:
pass

Expand All @@ -271,12 +276,12 @@ def __init__(self,el):
# require a set of nested checks, exception catching is more
# clean.
try:
self.contact['email'] = contact.EmailAddress.text
self.contact['email'] = contact.EmailAddress.text.strip()
except:
pass

try:
self.contact['telephone'] = contact.TelephoneNumber.text
self.contact['telephone'] = contact.TelephoneNumber.text.strip()
except:
pass
except:
Expand Down

0 comments on commit 2c2a203

Please sign in to comment.