Mercurial > dive4elements > river
comparison flys-backend/contrib/shpimporter/importer.py @ 5401:ff11b178f152
Fix searchValue and mark a field where a string is found as handled
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 25 Mar 2013 12:19:40 +0100 |
parents | 6c2751c17869 |
children | db5def5456ce |
comparison
equal
deleted
inserted
replaced
5400:acc34bf0d5b2 | 5401:ff11b178f152 |
---|---|
45 return False # Avoids an Error in IsFieldSet | 45 return False # Avoids an Error in IsFieldSet |
46 return feat.IsFieldSet(feat.GetFieldIndex(name)) | 46 return feat.IsFieldSet(feat.GetFieldIndex(name)) |
47 | 47 |
48 def searchValue(self, feat, regex): | 48 def searchValue(self, feat, regex): |
49 """ | 49 """ |
50 Searches for a value that matches regx in all attribute | 50 Searches for a value that matches regex in all attribute |
51 fields of a feature. | 51 fields of a feature. |
52 | |
53 @returns the name of the field where a match was found or None | |
52 """ | 54 """ |
53 for val in feat.items(): | 55 for val in feat.items(): |
54 match = re.match(regex, val, re.IGNORECASE) | 56 match = re.match(regex, feat.items()[val], re.IGNORECASE) |
55 return match != None | 57 if match: |
58 return val | |
56 | 59 |
57 def searchField(self, regex): | 60 def searchField(self, regex): |
58 """ | 61 """ |
59 Searches for a field in the current src layer that matches | 62 Searches for a field in the current src layer that matches |
60 the expression regex. | 63 the expression regex. |