~ubuntu-branches/ubuntu/trusty/lottanzb/trusty

« back to all changes in this revision

Viewing changes to lottanzb/backend/sessions/errors.py

  • Committer: Daniel Holbach
  • Date: 2011-02-21 07:47:30 UTC
  • mfrom: (7.1.1 natty)
  • Revision ID: daniel.holbach@canonical.com-20110221074730-9ozyhdic25bo6k2g
Tags: 0.6-1ubuntu1
* debian/lottanzb.install, debian/icons/*:
  + Add dark and light application icon for the panel menu.
* New upstream release.

* Switch to dpkg-source 3.0 (quilt) format.
* Use debhelper 7 instead of cdbs.
* Use dh_python2 instead of python-support.
* Delete superfluous debian/pyversions and debian/pycompat.

* debian/compat:
  + Bump to debhelper 7.
* debian/control:
  + Change Priority from extra to optional.
  + Replace XS-Python-Version with X-Python-Version and bump it to >= 2.6.
  + Remove cdbs and python-support from Build-Depends.
  + Bump debhelper to >= 7.0.50~ in Build-Depends.
  + Bump python to >= 2.6.6-3 in Build-Depends.
  + Remove python-kiwi, hellanzb and python from Depends.
  + Add python-configobj to Depends.
  + Bump python-gtk2 to >= 2.16 in Depends.
  + Bump yelp to >= 2.30 in Recommends for Mallard support.
  + Add python-apt and apturl to Recommends.
  + Add sabnzbdplus to Suggests.
  + Replace hellanzb with sabnzbdplus in Enhances.
  + Update Description.
* debian/copyright:
  + Make it machine-interpretable according to DEP-5.
  + Remove information for Kiwi code.
  + Update information for help/*.
  + Add information for lottanzb/backend/interface/multipart_post_handler.py.
* debian/lottanzb.lintian-overrides:
  + Override extra-license-file warning for documentation files.
* debian/lottanzb.menu:
  + Update application title.
* debian/patches/lock-file-name.patch:
  + Delete because fixed upstream.
* debian/rules:
  + Install into private directory /usr/share/lottanzb.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2008-2011 LottaNZB Development Team
 
2
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; version 3.
 
6
 
7
# This program is distributed in the hope that it will be useful,
 
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
# GNU General Public License for more details.
 
11
 
12
# You should have received a copy of the GNU General Public License
 
13
# along with this program; if not, write to the Free Software
 
14
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
15
 
 
16
from lottanzb.core.environ import _
 
17
 
 
18
__all__ = [
 
19
    "SessionError",
 
20
    "SessionStartError",
 
21
    "SessionNotSpecifiedError",
 
22
    "SessionUnknownError",
 
23
    "SessionConnectionError",
 
24
    "SessionNoExecutableError",
 
25
    "SessionNoServerError",
 
26
    "SessionPermissionError",
 
27
    "SessionImportError"
 
28
]
 
29
 
 
30
class SessionError(Exception):
 
31
    message = ""
 
32
    
 
33
    def __init__(self, session=None, message=""):
 
34
        self.session = session
 
35
        
 
36
        if message:
 
37
            self.message = message
 
38
        
 
39
        Exception.__init__(self)
 
40
    
 
41
    def __str__(self):
 
42
        if self.message:
 
43
            return self.message
 
44
        elif self.session:
 
45
            return _("Unknown error in session '%s'.") % self.session.get_name()
 
46
        else:
 
47
            return _("Unknown error in session.")
 
48
 
 
49
 
 
50
class SessionStartError(SessionError):
 
51
    def __str__(self):
 
52
        prefix = _("Could not start session")
 
53
        
 
54
        if self.session:
 
55
            prefix = _("Could not start session '%s'") % self.session.get_name()
 
56
        
 
57
        if self.message:
 
58
            return "%s: %s" % (prefix, self.message)
 
59
        else:
 
60
            return prefix
 
61
 
 
62
class SessionNotSpecifiedError(SessionStartError):
 
63
    message = _("No session has been selected.")
 
64
 
 
65
 
 
66
class SessionUnknownError(SessionStartError):
 
67
    message = _("Unknown session type.")
 
68
 
 
69
 
 
70
class SessionConnectionError(SessionStartError):
 
71
    def __init__(self, session, connection_error, previous_success=False):
 
72
        self.connection_error = connection_error
 
73
        self.previous_success = previous_success
 
74
        
 
75
        SessionStartError.__init__(self, session,
 
76
            str(self.connection_error))
 
77
 
 
78
 
 
79
class SessionNoExecutableError(SessionStartError):
 
80
    message = _("Could not find the SABnzbd executable.")
 
81
 
 
82
 
 
83
class SessionNoServerError(SessionStartError):
 
84
    message = _("No news server has been specified.")
 
85
 
 
86
 
 
87
class SessionPermissionError(SessionStartError):
 
88
    message = _("Not allowed to launch SABnzbd.")
 
89
    
 
90
    def __init__(self, session=None, executable=None):
 
91
        SessionStartError.__init__(self, session)
 
92
        
 
93
        self.executable = executable
 
94
        
 
95
        if self.executable:
 
96
            extra_info = _("%s is probably not executable.") % self.executable
 
97
            
 
98
            self.message = "%s %s" % (self.message, extra_info)
 
99
 
 
100
 
 
101
class SessionImportError(SessionStartError):
 
102
    def __init__(self, session=None, module=""):
 
103
        SessionStartError.__init__(self, session)
 
104
        
 
105
        self.module = module
 
106
        self.message= _("Could not find the Python module '%s'.") % self.module