-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReviewRecord.py
More file actions
33 lines (30 loc) · 950 Bytes
/
ReviewRecord.py
File metadata and controls
33 lines (30 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import md5
class ReviewRecord(object):
def __init__(self):
self.hotel_name = ""
self.hotel_url = ""
self.source_site = ""
self.rate = 3
self.nick_name = ""
self.comment = ""
self.comment_date = ""
self.check_in_date = ""
self.timestamp = ""
self.consume_detail = ""
@property
def hash(self):
h = md5.new()
text = []
if self.nick_name:
text.append(self.nick_name.encode('utf-8'))
if self.hotel_name:
text.append(self.hotel_name.encode('utf-8'))
if self.source_site:
text.append(self.source_site.encode('utf-8'))
if self.comment:
text.append(self.comment.encode('utf-8'))
if self.check_in_date:
text.append(self.check_in_date.encode('utf-8'))
text.append(str(self.rate))
h.update('-'.join(text))
return h.hexdigest()