Fix user_self calling editGet with a wrong parameter
[Melange.git] / app / soc / models / review.py
bloba94f50170a37b33f4ecce698e0d705ae96542556
1 #!/usr/bin/python2.5
3 # Copyright 2008 the Melange authors.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 """This module contains the Review Model."""
19 __authors__ = [
20 '"Todd Larsen" <tlarsen@google.com>',
21 '"Sverre Rabbelier" <sverre@rabbelier.nl>',
22 '"Lennard de Rijk" <ljvderijk@gmail.com>',
26 from google.appengine.ext import db
28 import soc.models.comment
31 class Review(soc.models.comment.Comment):
32 """Model of a Review.
33 """
35 #: the score given by the reviewer
36 score = db.IntegerProperty(required=True, default=0)
38 #: An optional reference property to a reviewer so the information
39 #: from the Role can be used as well
40 reviewer = db.ReferenceProperty(reference_class=soc.models.role.Role,
41 required=False, collection_name="reviews")
43 def author_name(self):
44 """Property as 'author_name' for use in common templates.
45 """
46 if self.reviewer:
47 return self.reviewer.name()
48 else:
49 return self.author.name