Commit bad17bbf authored by Graziella Toutoungis's avatar Graziella Toutoungis
Browse files

merge

......@@ -25,8 +25,8 @@ class Person(EmailableMixIn, AnyEntity):
def name(self, civility=False):
if civility:
return u'%s. %s %s' % (self.req._(self.civility),
self.firstname or u'', self.surname or u'')
return u'%s %s %s' % (self.req._(self.civility),
self.firstname or u'', self.surname or u'')
return u'%s %s' % (self.firstname or u'', self.surname or u'')
......@@ -12,7 +12,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
msgid "Mr"
msgstr "M"
msgstr "M."
msgid "Mrs"
msgstr "Mme"
......
from yams.buildobjs import EntityType, SubjectRelation, String
try:
from yams.buildobjs import RichString
from yams.reader import context
defined_types = context.defined
except ImportError:
from cubicweb.schema import RichString
from cubicweb.schema import RQLConstraint
_ = unicode
class Person(EntityType):
"""a physical person"""
surname = String(required=True, fulltextindexed=True, indexed=True, maxsize=64)
......
......@@ -45,6 +45,6 @@ def install(**kwargs):
url=web,
data_files=data_files,
**kwargs)
if __name__ == '__main__' :
install()
......@@ -6,11 +6,12 @@
"""
__docformat__ = "restructuredtext en"
from logilab.mtconverter import html_escape
from logilab.mtconverter import xml_escape
from cubicweb.selectors import implements, rql_condition
from cubicweb.web import uicfg, action
from cubicweb.web.views import baseviews, primary, vcard
from cubicweb.web.facet import AttributeFacet
for attr in ('civility', 'description', 'firstname', 'surname'):
uicfg.primaryview_section.tag_attribute(('Person', attr), 'hidden')
......@@ -23,9 +24,13 @@ uicfg.autoform_is_inlined.tag_subject_of(('Person', 'postal_address', '*'), True
class PersonPrimaryView(primary.PrimaryView):
__select__ = implements('Person')
def render_entity_title(self, entity):
title = xml_escape(entity.dc_title())
self.w(u'<h1>%s</h1>' % entity.name(civility=True))
def render_entity_attributes(self, entity):
if getattr(entity, 'phone', None):
self.field('phone', ', '.join(html_escape(e.view('text'))
self.field('phone', ', '.join(xml_escape(e.view('text'))
for e in entity.phone))
if entity.use_email:
self.field('use_email',
......@@ -50,9 +55,9 @@ class PersonSecondaryView(baseviews.SecondaryView):
def cell_call(self, row, col):
entity = self.complete_entity(row, col)
self.w(u'&nbsp;')
name = html_escape(entity.name())
name = xml_escape(entity.name())
self.w(u'<a href="%s">%s</a><br/>%s' % (
html_escape(entity.absolute_url()), name,
xml_escape(entity.absolute_url()), name,
entity.printable_value('description')))
......@@ -74,7 +79,7 @@ class PersonEmailView(baseviews.EntityView):
entity = self.entity(row, col)
self.w(u'<h3>')
self.w(self.req._('emails sent or received by %s')
% html_escape(entity.dc_title()))
% xml_escape(entity.dc_title()))
self.w(u'</h3>')
done = set()
if getattr(entity, 'primary_email', None):
......@@ -89,8 +94,6 @@ class PersonEmailView(baseviews.EntityView):
email.view('shortprimary', w=self.w, skipeids=done)
class VCardPersonView(vcard.VCardCWUserView):
"""export a person information as a vcard"""
__select__ = implements('Person')
......@@ -123,4 +126,9 @@ class AddPersonFromEmailAction(action.LinkToEntityAction):
rtype = 'use_email'
target = 'subject'
## facets #####################################################################
class CivilityFacet(AttributeFacet):
id = 'civility-facet'
__select__ = implements('Person')
rtype = 'civility'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment