# HG changeset patch # User Sylvain Thénault # Date 1246870603 -7200 # Node ID daf6e178659f3ec3cfb6578995b1db3cd8ff713b # Parent f27a3a75be0d2c35424125651818f9756a12369f new case_insensitive_etypes resource on the cubicweb registry diff -r f27a3a75be0d -r daf6e178659f cwvreg.py --- a/cwvreg.py Mon Jul 06 10:56:13 2009 +0200 +++ b/cwvreg.py Mon Jul 06 10:56:43 2009 +0200 @@ -76,6 +76,11 @@ clear_cache(self, 'rqlhelper') # now we can load application's web objects self.register_objects(self.config.vregistry_path()) + # map lowered entity type names to their actual name + self.case_insensitive_etypes = {} + for etype in self.schema.entities(): + etype = str(etype) + self.case_insensitive_etypes[etype.lower()] = etype def update_schema(self, schema): """update .schema attribute on registered objects, necessary for some diff -r f27a3a75be0d -r daf6e178659f web/views/urlpublishing.py --- a/web/views/urlpublishing.py Mon Jul 06 10:56:13 2009 +0200 +++ b/web/views/urlpublishing.py Mon Jul 06 10:56:43 2009 +0200 @@ -144,18 +144,12 @@ [[/]/]* """ priority = 2 - def __init__(self, urlpublisher): - super(RestPathEvaluator, self).__init__(urlpublisher) - self.etype_map = {} - for etype in self.schema.entities(): - etype = str(etype) - self.etype_map[etype.lower()] = etype def evaluate_path(self, req, parts): if not (0 < len(parts) < 4): raise PathDontMatch() try: - etype = self.etype_map[parts.pop(0).lower()] + etype = self.vreg.case_insensitive_etypes[parts.pop(0).lower()] except KeyError: raise PathDontMatch() cls = self.vreg.etype_class(etype)