author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Fri, 05 Feb 2010 08:11:32 +0100 | |
changeset 4460 | 5c22869079b9 |
parent 4252 | 6c4f109c2b03 |
child 5421 | 8167de96c523 |
permissions | -rw-r--r-- |
2094
59a4e9f4f57a
fix docstring, make Bookmark.title internationalizable for appl level bookmarks
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
1 |
"""the Bookmark entity type for internal links |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
2 |
|
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
3 |
:organization: Logilab |
4212
ab6573088b4a
update copyright: welcome 2010
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
4 |
:copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
7 |
""" |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
8 |
__docformat__ = "restructuredtext en" |
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
9 |
_ = unicode |
0 | 10 |
|
2297
4cf57dd80650
missing imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2144
diff
changeset
|
11 |
from yams.buildobjs import EntityType, RelationType, SubjectRelation, String |
4cf57dd80650
missing imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2144
diff
changeset
|
12 |
from cubicweb.schema import RRQLExpression |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
13 |
|
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
14 |
class Bookmark(EntityType): |
2094
59a4e9f4f57a
fix docstring, make Bookmark.title internationalizable for appl level bookmarks
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
15 |
"""bookmarks are used to have user's specific internal links""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2297
diff
changeset
|
16 |
__permissions__ = { |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
17 |
'read': ('managers', 'users', 'guests',), |
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
18 |
'add': ('managers', 'users',), |
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
19 |
'delete': ('managers', 'owners',), |
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
20 |
'update': ('managers', 'owners',), |
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
21 |
} |
2144 | 22 |
|
2094
59a4e9f4f57a
fix docstring, make Bookmark.title internationalizable for appl level bookmarks
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
23 |
title = String(required=True, maxsize=128, internationalizable=True) |
0 | 24 |
path = String(maxsize=512, required=True, |
25 |
description=_("relative url of the bookmarked page")) |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
26 |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
27 |
bookmarked_by = SubjectRelation('CWUser', |
0 | 28 |
description=_("users using this bookmark")) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
29 |
|
0 | 30 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
31 |
class bookmarked_by(RelationType): |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2297
diff
changeset
|
32 |
__permissions__ = {'read': ('managers', 'users', 'guests',), |
0 | 33 |
# test user in users group to avoid granting permission to anonymous user |
34 |
'add': ('managers', RRQLExpression('O identity U, U in_group G, G name "users"')), |
|
35 |
'delete': ('managers', RRQLExpression('O identity U, U in_group G, G name "users"')), |
|
36 |
} |