Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
108
Merge Requests
108
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
faf3fa14
Commit
faf3fa14
authored
Mar 05, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Surcharge person.getTitle
parent
88bdb0e7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
2 deletions
+47
-2
master/bt5/slapos_cloud/DocumentTemplateItem/Person.py
master/bt5/slapos_cloud/DocumentTemplateItem/Person.py
+15
-0
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCloudDocument.py
.../slapos_cloud/TestTemplateItem/testSlapOSCloudDocument.py
+29
-0
master/bt5/slapos_cloud/bt/revision
master/bt5/slapos_cloud/bt/revision
+1
-1
master/bt5/slapos_cloud/bt/template_test_id_list
master/bt5/slapos_cloud/bt/template_test_id_list
+2
-1
No files found.
master/bt5/slapos_cloud/DocumentTemplateItem/Person.py
View file @
faf3fa14
from
AccessControl
import
ClassSecurityInfo
,
Unauthorized
,
getSecurityManager
from
Products.ERP5.Document.Person
import
Person
as
ERP5Person
from
Products.ERP5Type
import
Permissions
class
Person
(
ERP5Person
):
security
=
ClassSecurityInfo
()
...
...
@@ -36,3 +37,17 @@ class Person(ERP5Person):
"""Revokes existing certificate"""
self
.
_checkCertificateRequest
()
self
.
_revokeCertificate
()
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
,
**
kw
):
"""
Returns the title if it exists or a combination of
first name and last name
"""
title
=
ERP5Person
.
getTitle
(
self
,
**
kw
)
test_title
=
title
.
replace
(
' '
,
''
)
if
test_title
==
''
:
return
self
.
getDefaultEmailCoordinateText
()
else
:
return
title
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCloudDocument.py
0 → 100644
View file @
faf3fa14
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Nexedi SA and Contributors. All Rights Reserved.
import
transaction
from
Products.SlapOS.tests.testSlapOSMixin
import
\
testSlapOSMixin
class
TestSlapOSPersonDocument
(
testSlapOSMixin
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
def
test_getTitle
(
self
):
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
"Person"
)
# Default title is empty
self
.
assertEquals
(
person
.
getTitle
(),
None
)
# If not title, the email is used
person
.
edit
(
default_email_coordinate_text
=
"foo@example.org"
)
self
.
assertEquals
(
person
.
getTitle
(),
'foo@example.org'
)
# But if first name, last name are set, use them
person
.
edit
(
first_name
=
"foo"
,
last_name
=
"bar"
)
self
.
assertEquals
(
person
.
getTitle
(),
'foo bar'
)
# Finally, if the title is set
person
.
edit
(
title
=
"foobar"
)
self
.
assertEquals
(
person
.
getTitle
(),
'foobar'
)
master/bt5/slapos_cloud/bt/revision
View file @
faf3fa14
276
\ No newline at end of file
277
\ No newline at end of file
master/bt5/slapos_cloud/bt/template_test_id_list
View file @
faf3fa14
...
...
@@ -3,3 +3,4 @@ testSlapOSCloudConstraint
testSlapOSCloudSecurityGroup
testSlapOSCloudShadow
testSlapOSCloudWorkflow
testSlapOSCloudDocument
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment