-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeedback.py
169 lines (130 loc) · 4.48 KB
/
feedback.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
__author__ = 'Justice Ndou'
__website__ = 'http://jobcloud.freelancing-seo.com/'
__email__ = '[email protected]'
# Copyright 2014 Freelancing Solutions.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#class created to provide functionality related to a freelancer.
#this class is the cousin of jobseeker in the jobmarket.
#The class can also be useful on the Job Market as it can create functionality for a freelancer there.
from google.appengine.ext import db
from ConstantsAndErrorCodes import MyConstants, ErrorCodes
class Feedback(db.Expando, MyConstants, ErrorCodes):
Firstname = db.StringProperty()
Email = db.EmailProperty()
Subject = db.StringProperty()
Body = db.StringProperty(multiline=True)
Attended = db.BooleanProperty(default=False)
CustomerSatisfied = db.BooleanProperty(default=False)
def createFeedback(self, inFirstname, inEmail, inSubject, inBody):
try:
if self.writeFirstname(inFirstname) and self.writeEmail(inEmail) and self.writeSubject(inSubject) and self.writeBody(inBody):
tempKey = self.put()
return tempKey
else:
return self.undefined
except:
return self._generalError
def writeCustomerSatisfied(self, Binput):
try:
self.CustomerSatisfied = Binput
return True
except:
return self._generalError
def readFirstname(self):
try:
temp = str(self.Firstname)
temp = temp.strip()
if temp.isalpha():
return temp
else:
return self.undefined
except:
return self._generalError
def writeFirstname(self, strinput):
try:
strinput = str(strinput)
strinput = strinput.strip()
if strinput.isalpha():
self.Firstname = strinput
return True
else:
return False
except:
return self._generalError
def readEmail(self):
try:
temp = str(self.Email)
temp = temp.strip()
if len(temp) > 0:
return temp
else:
return self.undefined
except:
return self._generalError
def writeEmail(self, strinput):
try:
strinput = str(strinput)
strinput = strinput.strip()
if len(strinput) > 0:
findrequest = db.Query(Feedback).filter('Email =', strinput).filter('CustomerSatisfied =', False)
results = findrequest.fetch(limit=self._maxQResults)
if len(results) > 0:
return False
else:
self.Email = strinput
return True
else:
return False
except:
return self._generalError
def readSubject(self):
try:
temp = str(self.Subject)
temp = temp.strip()
if len(temp) > 0:
return temp
else:
return self.undefined
except:
return self._generalError
def writeSubject(self, strinput):
try:
strinput = str(strinput)
strinput = strinput.strip()
if len(strinput) > 0:
self.Subject = strinput
return True
else:
return False
except:
return self._generalError
def readBody(self):
try:
temp = str(self.Body)
if len(temp) > 0:
return temp
else:
return self.undefined
except:
return self._generalError
def writeBody(self, strinput):
try:
strinput = str(strinput)
if len(strinput) > 0:
self.Body = strinput
return True
else:
return False
except:
return self._generalError