Changeset 740
- Timestamp:
- 03/28/07 16:42:51 (2 years ago)
- Files:
-
- PleiadesEntity/trunk/Extensions/cooking.py (deleted)
- PleiadesEntity/trunk/Extensions/loader.py (modified) (2 diffs)
- PleiadesEntity/trunk/Extensions/ws_grek.py (modified) (1 diff)
- PleiadesEntity/trunk/Extensions/ws_latn.py (added)
- PleiadesEntity/trunk/Extensions/ws_validation.py (added)
- PleiadesEntity/trunk/content/Name.py (modified) (2 diffs)
- PleiadesEntity/trunk/models/PleiadesEntity.zargo (modified) (previous)
- PleiadesEntity/trunk/models/PleiadesEntityUML.png (modified) (previous)
- PleiadesEntity/trunk/tests/NameViews.txt (modified) (1 diff)
- PleiadesEntity/trunk/tests/Names.txt (added)
- PleiadesEntity/trunk/tests/WSValidation.txt (added)
- PleiadesEntity/trunk/tests/_testing.py.template (modified) (1 diff)
- PleiadesEntity/trunk/tests/data/nametwister.xml (added)
- PleiadesEntity/trunk/version.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
PleiadesEntity/trunk/Extensions/loader.py
r711 r740 38 38 39 39 from Products.PleiadesEntity.Extensions.xmlutil import * 40 from Products.PleiadesEntity.Extensions. cooking import *40 from Products.PleiadesEntity.Extensions.ws_validation import validate_name 41 41 42 42 from Products.PleiadesEntity.config import * … … 219 219 nameAttested = '' 220 220 nameLanguage = '' 221 222 if nameAttested and nameLanguage: 223 invalid = validate_name(nameLanguage, nameAttested.encode('utf-8')) 224 if invalid: 225 raise EntityLoadError, invalid.decode('utf-8').encode('ascii', 'backslashreplace') 221 226 222 227 d = e.findall("{%s}description" % DC) PleiadesEntity/trunk/Extensions/ws_grek.py
r739 r740 311 311 pass 312 312 if not(b): 313 invalids.append( (i, c, cval, 'illegal character in appropriate Unicode range'))313 invalids.append({'position':i, 'character':c, 'reason':'illegal character in appropriate Unicode range'}) 314 314 else: 315 invalids.append( (i, c, cval, 'illegal character from outside appropriate Unicode range'))315 invalids.append({'position':i, 'character':c, 'reason':'illegal character from outside appropriate Unicode range'}) 316 316 return invalids 317 317 PleiadesEntity/trunk/content/Name.py
r734 r740 34 34 from Products.PleiadesEntity.config import * 35 35 36 # additional imports from tagged value 'import'37 from Products.PleiadesEntity.Extensions.cooking import *38 39 36 ##code-section module-header #fill in your manual code here 37 from Products.CMFCore.permissions import View 38 from Products.PleiadesEntity.Extensions.ws_validation import validate_name 40 39 ##/code-section module-header 41 40 … … 162 161 return periods 163 162 163 security.declareProtected(View, 'post_validate') 164 def post_validate(self, REQUEST=None, errors=None): 165 vNameLanguage = REQUEST.get('nameLanguage', None) 166 vNameAttested = REQUEST.get('nameAttested', None) 167 invalid = validate_name(vNameLanguage, vNameAttested) 168 if len(invalid) > 0: 169 errors['nameAttested'] = invalid 170 164 171 165 172 registerType(Name, PROJECTNAME) PleiadesEntity/trunk/tests/NameViews.txt
r602 r740 54 54 '...Name as Attested...' 55 55 56 # >>> browser.contents 57 # '...Language and Writing System of Attested Name...' 58 # 59 # >>> browser.contents 60 # '...Time Periods...' 61 # 62 # >>> browser.contents 63 # '...Primary References...' 64 # 65 # >>> browser.contents 66 # '...Secondary References...' 56 >>> browser.contents 57 '...Language and Writing System...' 67 58 59 >>> browser.contents 60 '...Name type...' 68 61 62 >>> browser.contents 63 '...Accuracy of Attestation...' 64 65 >>> browser.contents 66 '...Completeness of Attestation...' 67 68 >>> browser.contents 69 '...Temporal attestations...' 70 71 >>> browser.contents 72 '...Primary References...' 73 74 >>> browser.contents 75 '...Secondary references...' 76 77 Edit the name, modify the attestation using legal characters and language to verify validation 78 79 >>> browser.getLink('Log in').click() 80 >>> browser.getControl('Login Name').value = 'test_user_1_' 81 >>> browser.getControl('Password').value = 'secret' 82 >>> browser.getControl('Log in').click() 83 >>> url = url + '/base_edit' 84 >>> browser.open(url) 85 >>> control = browser.getControl(name='nameAttested') 86 >>> control.value = 'Innoxium Municipium' 87 >>> control = browser.getControl(name='nameLanguage') 88 >>> control.value = ['la'] 89 >>> control = browser.getControl(name='title') 90 >>> control.value = 'Innoxium Municipium' 91 >>> browser.getControl(name='form_submit').click() 92 >>> browser.contents 93 '...Changes saved...' 94 95 Edit the name again, modify the attestation using illegal characters and language to verify validation 96 97 >>> url = url + '/base_edit' 98 >>> browser.open(url) 99 >>> control = browser.getControl(name='nameAttested') 100 >>> control.value = 'Municipium Noxium Maximum' 101 >>> control = browser.getControl(name='nameLanguage') 102 >>> control.value = ['grc'] 103 >>> control = browser.getControl(name='title') 104 >>> control.value = 'Municipium Noxium Maximum' 105 >>> browser.getControl(name='form_submit').click() 106 >>> browser.contents 107 '...23 invalid character(s) in name Municipium Noxium Maximum...' PleiadesEntity/trunk/tests/_testing.py.template
r605 r740 14 14 from Products.PleiadesEntity.Extensions.loader import BA_ID_MAX 15 15 from Products.PleiadesEntity.Extensions.xmlutil import purifyText 16 from Products.PleiadesEntity.Extensions.cooking import setGeoTitleFromNames17 16 PleiadesEntity/trunk/version.txt
r706 r740 1 0.1 build 2 591 0.1 build 260
