web/views/owl.py
changeset 3451 6b46d73823f5
parent 3377 dd9d292b6a6d
child 3460 e4843535db25
--- a/web/views/owl.py	Wed Sep 23 19:26:38 2009 +0200
+++ b/web/views/owl.py	Wed Sep 23 19:40:19 2009 +0200
@@ -64,9 +64,9 @@
     content_type = 'application/xml' # 'text/xml'
 
     def call(self, writeprefix=True):
-        skipmeta = int(self.req.form.get('skipmeta', True))
+        skipmeta = int(self._cw.form.get('skipmeta', True))
         if writeprefix:
-            self.w(OWL_OPENING_ROOT % {'appid': self.schema.name})
+            self.w(OWL_OPENING_ROOT % {'appid': self._cw.schema.name})
         self.visit_schema(skiptypes=skipmeta and schema.SKIP_TYPES or ())
         if writeprefix:
             self.w(OWL_CLOSING_ROOT)
@@ -74,12 +74,12 @@
     def should_display_rschema(self, rschema):
         return not rschema in self.skiptypes and (
             rschema.has_local_role('read') or
-            rschema.has_perm(self.req, 'read'))
+            rschema.has_perm(self._cw, 'read'))
 
     def visit_schema(self, skiptypes):
         """get a layout for a whole schema"""
         self.skiptypes = skiptypes
-        entities = sorted(eschema for eschema in self.schema.entities()
+        entities = sorted(eschema for eschema in self._cw.schema.entities()
                           if not eschema.is_final() or eschema in skiptypes)
         self.w(u'<!-- classes definition -->')
         for eschema in entities:
@@ -151,13 +151,13 @@
     content_type = 'application/xml' # 'text/xml'
 
     def call(self):
-        self.w(OWL_OPENING_ROOT % {'appid': self.schema.name})
-        for i in xrange(self.rset.rowcount):
+        self.w(OWL_OPENING_ROOT % {'appid': self._cw.schema.name})
+        for i in xrange(self.cw_rset.rowcount):
             self.cell_call(i, 0)
         self.w(OWL_CLOSING_ROOT)
 
     def cell_call(self, row, col):
-        self.wview('owlaboxitem', self.rset, row=row, col=col)
+        self.wview('owlaboxitem', self.cw_rset, row=row, col=col)
 
 
 class OWLABOXItemView(EntityView):
@@ -167,14 +167,14 @@
     content_type = 'application/xml' # 'text/xml'
 
     def cell_call(self, row, col):
-        entity = self.complete_entity(row, col)
+        entity = self.cw_rset.complete_entity(row, col)
         eschema = entity.e_schema
         self.w(u'<%s rdf:ID="%s">' % (eschema, entity.eid))
         self.w(u'<!--attributes-->')
         for rschema, aschema in eschema.attribute_definitions():
             if rschema.meta:
                 continue
-            if not (rschema.has_local_role('read') or rschema.has_perm(self.req, 'read')):
+            if not (rschema.has_local_role('read') or rschema.has_perm(self._cw, 'read')):
                 continue
             aname = rschema.type
             if aname == 'eid':
@@ -189,14 +189,14 @@
         for rschema, targetschemas, role in eschema.relation_definitions():
             if rschema.meta:
                 continue
-            if not (rschema.has_local_role('read') or rschema.has_perm(self.req, 'read')):
+            if not (rschema.has_local_role('read') or rschema.has_perm(self._cw, 'read')):
                 continue
             if role == 'object':
                 attr = 'reverse_%s' % rschema.type
             else:
                 attr = rschema.type
             for x in getattr(entity, attr):
-                self.w(u'<%s>%s %s</%s>' % (attr, x.id, x.eid, attr))
+                self.w(u'<%s>%s %s</%s>' % (attr, x.__regid__, x.eid, attr))
         self.w(u'</%s>'% eschema)