/usr/lib/python3/dist-packages/trytond/exceptions.py is in tryton-server 4.6.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | # This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import sys
class TrytonException(Exception):
if sys.version_info < (3, ):
def __str__(self):
return str(self).encode('utf-8')
class UserError(TrytonException):
def __init__(self, message, description=''):
super(UserError, self).__init__('UserError', (message, description))
self.message = message
self.description = description
self.code = 1
def __unicode__(self):
return '%s - %s' % (self.message, self.description)
class UserWarning(TrytonException):
def __init__(self, name, message, description=''):
super(UserWarning, self).__init__('UserWarning', (name, message,
description))
self.name = name
self.message = message
self.description = description
self.code = 2
def __unicode__(self):
return '%s - %s' % (self.message, self.description)
class LoginException(TrytonException):
"""Request the named parameter for the login process.
The type can be 'password' or 'char'.
"""
def __init__(self, name, message, type='password'):
super(LoginException, self).__init__(
'LoginException', (name, message, type))
self.name = name
self.message = message
self.type = type
self.code = 3
class ConcurrencyException(TrytonException):
def __init__(self, message):
super(ConcurrencyException, self).__init__('ConcurrencyException',
message)
self.message = message
self.code = 4
def __unicode__(self):
return self.message
class RateLimitException(TrytonException):
"""User has sent too many requests in a given amount of time."""
class MissingDependenciesException(TrytonException):
def __init__(self, missings):
self.missings = missings
def __unicode__(self):
return 'Missing dependencies: %s' % ' '.join(self.missings)
|