LibraryOfCongress / viewshare

A web application developed by Zepheira for the Library of Congress National Digital Information Infrastructure and Preservation Program (NDIIPP) which allows users to create and share embeddable interfaces to digital cultural heritage collections. A project of the Library of Congress; the project was retired in March 2018. Note: project members may work on both official Library of Congress projects and non-LC projects.
https://labs.loc.gov/work/experiments/viewshare/
Other
45 stars 15 forks source link

Certain property names do no match pattern for properties/<property>/data/ URI #161

Closed ptrourke closed 2 years ago

ptrourke commented 9 years ago

See https://viewshare.uservoice.com/admin/tickets/102.

If a column name in an XLS file has a space in it, the property name does not match the pattern in the URLs file for 'views/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/draft/properties/(?P[a-zA-Z0-9_.-]+)/data/$'

Are the property name spaces being properly slugged as underscores?

Stack trace:

NoReverseMatch at /views/[username]/f47d169d-5e72-4cff-99d1-4ad2efddd11a/draft/ Reverse for 'draft_exhibit_propertydata' with arguments '()' and keyword arguments '{'owner': '[username]', 'property': 'Keyword 1', 'slug': 'f47d169d-5e72-4cff-99d1-4ad2efddd11a'}' not found. 1 pattern(s) tried: ['views/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/draft/properties/(?P[a-zA-Z0-9.-]+)/data/$'] Request Method: GET Request URL: http://viewshare.org/views/[username]/f47d169d-5e72-4cff-99d1-4ad2efddd11a/draft/ Django Version: 1.6.7 Exception Type: NoReverseMatch Exception Value:
Reverse for 'draft_exhibit_propertydata' with arguments '()' and keyword arguments '{'owner': '[username]', 'property': 'Keyword 1', 'slug': 'f47d169d-5e72-4cff-99d1-4ad2efddd11a'}' not found. 1 pattern(s) tried: ['views/(?P[a-zA-Z0-9.-]+)/(?P[a-zA-Z0-9.-]+)/draft/properties/(?P[a-zA-Z0-9.-]+)/data/$'] Exception Location: /srv/viewshare/shared/env/local/lib/python2.7/site-packages/django/core/urlresolvers.py in _reverse_with_prefix, line 456 Python Executable: /srv/viewshare/shared/env/bin/python Python Version: 2.7.6

ptrourke commented 9 years ago

So, in this case, only the last property, "Keywords 1", doesn't match. This suggests the problem is with slug generation either for the last property or for properties which end in numerals.

ptrourke commented 9 years ago

In akara, am seeing inconsistent slugification of property names.

curl --request POST --data-binary "@Properties_Issues.xls" --header "Content-Type: application/vnd.ms-excel" "http://localhost:8881/freemix.json"
{
    "items": [
        {
            "Discipline": "Physics", 
            "Article_Title": "Teaching for Transitions Today", 
            "Date_of_Publication": 2001, 
            "Transition_Type": "Transitions In", 
            "Journal_Title": "Journal of Transitions in Education", 
            "Location_of_Research": "Ireland", 
            "id": "_0", 
            "Lead_Author": "Smith, John", 
            "Keyword_1": "undergraduate; special needs; portfolio; employability", 
            "Summary": "This is a test", 
            "Volume_and_Issue": 1.1, 
            "Source_Database": "EBSCO", 
            "label": "_0", 
            "Pages": "115-150"
        }, 
  {
            "Discipline": "Social Sciences", 
            "Keyword 1": "transferable skills; CV; employability", 
            "Volume_and_Issue": 10.5, 
            "id": "_1", 
            "Location_of_Research": "Australia", 
            "Lead_Author": "Dunne, Mary", 
            "label": "_1", 
            "Pages": "79-90", 
            "Date_of_Publication": 2003, 
            "Journal_Title": "Journal of Education in the Humanities", 
            "Summary": "This is another test", 
            "Source_Database": "ERIC", 
            "Article_Title": "Transitions in the Humanities: A case study", 
            "Co_authors": "Lynch, Simon", 
            "Transition_Type": "Transitions Through"
        }, 
ptrourke commented 9 years ago

In Zenpub, spreadsheet.py doesn't slugify the property titles. However, in freemix_akara, in load_data.py, new_k = UNSUPPORTED_IN_EXHIBITKEY.sub('_', k) occurs several times; it is possible that this is source of the issue (add breakpoint at l. 385).