Commits

gweis committed 22a5d95

allow sorting of properties within a format

Comments (0)

Files changed (1)

ordf/vocab/fresnel.py

         self.group = None
         self.stylesheets = None
 
-    def properties(self, graph, resource):
+    def properties(self, graph, resource, sorted=False):
         properties = []
         for properties in self.objects(self.identifier, FRESNEL["showProperties"]):
             properties = Collection(self, properties)
                         yield prop, lens, self.group.formats.get(prop, Format())
                     subProperties.append(prop)
             elif prop == FRESNEL["allProperties"]:
-                for prop in graph.distinct_predicates(resource, None):
+                proplist = graph.distinct_predicates(resource, None)
+                if sorted:
+                    proplist.sort()
+                for prop in proplist:
                     if prop not in hideProperties and prop not in subProperties and prop not in properties:
                         yield prop, None, self.group.formats.get(prop, Format())
             else: