5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
7 """ |
7 """ |
8 __docformat__ = "restructuredtext en" |
8 __docformat__ = "restructuredtext en" |
9 |
9 |
10 from logilab.mtconverter import html_escape |
10 from logilab.mtconverter import xml_escape |
11 |
11 |
12 from cubicweb.selectors import one_line_rset, implements, match_user_groups |
12 from cubicweb.selectors import one_line_rset, implements, match_user_groups |
13 from cubicweb.view import EntityView |
13 from cubicweb.view import EntityView |
14 from cubicweb.web import action |
14 from cubicweb.web import action |
15 from cubicweb.web.views import primary |
15 from cubicweb.web.views import primary |
50 self.w(u'''<foaf:PersonalProfileDocument rdf:about=""> |
50 self.w(u'''<foaf:PersonalProfileDocument rdf:about=""> |
51 <foaf:maker rdf:resource="%s"/> |
51 <foaf:maker rdf:resource="%s"/> |
52 <foaf:primaryTopic rdf:resource="%s"/> |
52 <foaf:primaryTopic rdf:resource="%s"/> |
53 </foaf:PersonalProfileDocument>''' % (entity.absolute_url(), entity.absolute_url())) |
53 </foaf:PersonalProfileDocument>''' % (entity.absolute_url(), entity.absolute_url())) |
54 self.w(u'<foaf:Person rdf:ID="%s">\n' % entity.eid) |
54 self.w(u'<foaf:Person rdf:ID="%s">\n' % entity.eid) |
55 self.w(u'<foaf:name>%s</foaf:name>\n' % html_escape(entity.dc_long_title())) |
55 self.w(u'<foaf:name>%s</foaf:name>\n' % xml_escape(entity.dc_long_title())) |
56 if entity.surname: |
56 if entity.surname: |
57 self.w(u'<foaf:family_name>%s</foaf:family_name>\n' |
57 self.w(u'<foaf:family_name>%s</foaf:family_name>\n' |
58 % html_escape(entity.surname)) |
58 % xml_escape(entity.surname)) |
59 if entity.firstname: |
59 if entity.firstname: |
60 self.w(u'<foaf:givenname>%s</foaf:givenname>\n' |
60 self.w(u'<foaf:givenname>%s</foaf:givenname>\n' |
61 % html_escape(entity.firstname)) |
61 % xml_escape(entity.firstname)) |
62 emailaddr = entity.get_email() |
62 emailaddr = entity.get_email() |
63 if emailaddr: |
63 if emailaddr: |
64 self.w(u'<foaf:mbox>%s</foaf:mbox>\n' % html_escape(emailaddr)) |
64 self.w(u'<foaf:mbox>%s</foaf:mbox>\n' % xml_escape(emailaddr)) |
65 self.w(u'</foaf:Person>\n') |
65 self.w(u'</foaf:Person>\n') |