| 30 | |
| 31 | |
| 32 | class Namespace(object): |
| 33 | supported_namespaces = { |
| 34 | # RDF-based namespace |
| 35 | 'http://creativecommons.org/ns#license': 'cc', |
| 36 | |
| 37 | # Old RDF-based namespace |
| 38 | 'http://web.resource.org/cc/': 'cc', |
| 39 | |
| 40 | # RSS-based namespace |
| 41 | 'http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html': 'creativecommons', |
| 42 | |
| 43 | # Old RSS-based namespace |
| 44 | 'http://backend.userland.com/creativeCommonsRssModule': 'creativecommons', |
| 45 | } |
| 46 | |
| 47 | def _start_cc_license(self, attrs_d): |
| 48 | context = self._get_context() |
| 49 | value = self._get_attribute(attrs_d, 'rdf:resource') |
| 50 | attrs_d = FeedParserDict() |
| 51 | attrs_d['rel'] = 'license' |
| 52 | if value: |
| 53 | attrs_d['href'] = value |
| 54 | context.setdefault('links', []).append(attrs_d) |
| 55 | |
| 56 | def _start_creativecommons_license(self, attrs_d): |
| 57 | self.push('license', 1) |
| 58 | _start_creativeCommons_license = _start_creativecommons_license |
| 59 | |
| 60 | def _end_creativecommons_license(self): |
| 61 | value = self.pop('license') |
| 62 | context = self._get_context() |
| 63 | attrs_d = FeedParserDict() |
| 64 | attrs_d['rel'] = 'license' |
| 65 | if value: |
| 66 | attrs_d['href'] = value |
| 67 | context.setdefault('links', []).append(attrs_d) |
| 68 | del context['license'] |
| 69 | _end_creativeCommons_license = _end_creativecommons_license |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…