equal
deleted
inserted
replaced
115 |
115 |
116 class Unauthorized(SecurityError): |
116 class Unauthorized(SecurityError): |
117 """raised when a user tries to perform an action without sufficient |
117 """raised when a user tries to perform an action without sufficient |
118 credentials |
118 credentials |
119 """ |
119 """ |
120 msg = 'You are not allowed to perform this operation' |
120 msg = u'You are not allowed to perform this operation' |
121 msg1 = 'You are not allowed to perform %s operation on %s' |
121 msg1 = u'You are not allowed to perform %s operation on %s' |
122 var = None |
122 var = None |
123 |
123 |
124 def __str__(self): |
124 def __unicode__(self): |
125 try: |
125 try: |
126 if self.args and len(self.args) == 2: |
126 if self.args and len(self.args) == 2: |
127 return self.msg1 % self.args |
127 return self.msg1 % self.args |
128 if self.args: |
128 if self.args: |
129 return ' '.join(self.args) |
129 return u' '.join(self.args) |
130 return self.msg |
130 return self.msg |
131 except Exception as ex: |
131 except Exception as ex: |
132 return str(ex) |
132 return text_type(ex) |
133 |
133 |
134 class Forbidden(SecurityError): |
134 class Forbidden(SecurityError): |
135 """raised when a user tries to perform a forbidden action |
135 """raised when a user tries to perform a forbidden action |
136 """ |
136 """ |
137 |
137 |