Browse Source

Make Panic messages translatable.

Enable ^C when running from source on OSX.
tags/0.6.0
ShyPike 15 years ago
parent
commit
cf87ed0956
  1. 2
      SABnzbd.py
  2. 309
      po/main/SABnzbd.pot
  3. 86
      sabnzbd/misc.py

2
SABnzbd.py

@ -1144,7 +1144,7 @@ def main():
# Find external programs # Find external programs
sabnzbd.newsunpack.find_programs(sabnzbd.DIR_PROG) sabnzbd.newsunpack.find_programs(sabnzbd.DIR_PROG)
if not sabnzbd.WIN_SERVICE and not sabnzbd.DARWIN: if not sabnzbd.WIN_SERVICE and not getattr(sys, 'frozen', None) == 'macosx_app':
signal.signal(signal.SIGINT, sabnzbd.sig_handler) signal.signal(signal.SIGINT, sabnzbd.sig_handler)
signal.signal(signal.SIGTERM, sabnzbd.sig_handler) signal.signal(signal.SIGTERM, sabnzbd.sig_handler)

309
po/main/SABnzbd.pot

@ -12,7 +12,7 @@ msgstr ""
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ASCII\n" "Content-Type: text/plain; charset=ASCII\n"
"Content-Transfer-Encoding: 7bit\n" "Content-Transfer-Encoding: 7bit\n"
"POT-Creation-Date: 2010-10-09 11:41+West-Europa (zomertijd)\n" "POT-Creation-Date: 2010-10-17 22:26+CEST\n"
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
@ -20,35 +20,35 @@ msgstr ""
msgid "Failed to start web-interface" msgid "Failed to start web-interface"
msgstr "" msgstr ""
#: SABnzbd.py:325 #: SABnzbd.py:327
msgid "Cannot find web template: %s, trying standard template" msgid "Cannot find web template: %s, trying standard template"
msgstr "" msgstr ""
#: SABnzbd.py:446 #: SABnzbd.py:448
msgid "_yenc module... NOT found!" msgid "_yenc module... NOT found!"
msgstr "" msgstr ""
#: SABnzbd.py:453 #: SABnzbd.py:455
msgid "par2 binary... NOT found!" msgid "par2 binary... NOT found!"
msgstr "" msgstr ""
#: SABnzbd.py:461 #: SABnzbd.py:463
msgid "unrar binary... NOT found" msgid "unrar binary... NOT found"
msgstr "" msgstr ""
#: SABnzbd.py:466 #: SABnzbd.py:468
msgid "unzip binary... NOT found!" msgid "unzip binary... NOT found!"
msgstr "" msgstr ""
#: SABnzbd.py:570 #: SABnzbd.py:572
msgid "Please be aware the 0.0.0.0 hostname will need an IPv6 address for external access" msgid "Please be aware the 0.0.0.0 hostname will need an IPv6 address for external access"
msgstr "" msgstr ""
#: SABnzbd.py:1234 #: SABnzbd.py:1221
msgid "Disabled HTTPS because of missing CERT and KEY files" msgid "Disabled HTTPS because of missing CERT and KEY files"
msgstr "" msgstr ""
#: SABnzbd.py:1409 SABnzbdDelegate.py:730 #: SABnzbd.py:1416 SABnzbdDelegate.py:730
msgid "SABnzbd shutdown finished" msgid "SABnzbd shutdown finished"
msgstr "" msgstr ""
@ -157,50 +157,6 @@ msgstr ""
msgid "Stopping..." msgid "Stopping..."
msgstr "" msgstr ""
#: sabnzbd/utils/servertests.py:35
msgid "The hostname is not set."
msgstr ""
#: sabnzbd/utils/servertests.py:40
msgid "There are no connections set. Please set at least one connection."
msgstr ""
#: sabnzbd/utils/servertests.py:67
msgid "Password masked in ******, please re-enter"
msgstr ""
#: sabnzbd/utils/servertests.py:71
msgid "Invalid server details"
msgstr ""
#: sabnzbd/utils/servertests.py:83
msgid "Timed out: Try enabling SSL or connecting on a different port."
msgstr ""
#: sabnzbd/utils/servertests.py:85
msgid "Timed out"
msgstr ""
#: sabnzbd/utils/servertests.py:105
msgid "Server requires username and password."
msgstr ""
#: sabnzbd/utils/servertests.py:108
msgid "Connection Successful!"
msgstr ""
#: sabnzbd/utils/servertests.py:111
msgid "Authentication failed, check username/password."
msgstr ""
#: sabnzbd/utils/servertests.py:114
msgid "Too many connections, please pause downloading or try again later"
msgstr ""
#: sabnzbd/utils/servertests.py:117
msgid "Could not determine connection result (%s)"
msgstr ""
#: sabnzbd/__init__.py:155 #: sabnzbd/__init__.py:155
msgid "Signal %s caught, saving and exiting..." msgid "Signal %s caught, saving and exiting..."
msgstr "" msgstr ""
@ -333,15 +289,15 @@ msgstr ""
msgid "%s => missing from all servers, discarding" msgid "%s => missing from all servers, discarding"
msgstr "" msgstr ""
#: sabnzbd/dirscanner.py:121 sabnzbd/dirscanner.py:184 #: sabnzbd/dirscanner.py:120 sabnzbd/dirscanner.py:183
msgid "Error removing %s" msgid "Error removing %s"
msgstr "" msgstr ""
#: sabnzbd/dirscanner.py:156 #: sabnzbd/dirscanner.py:155
msgid "Cannot read %s" msgid "Cannot read %s"
msgstr "" msgstr ""
#: sabnzbd/dirscanner.py:280 sabnzbd/dirscanner.py:364 #: sabnzbd/dirscanner.py:279 sabnzbd/dirscanner.py:363
msgid "Cannot read Watched Folder %s" msgid "Cannot read Watched Folder %s"
msgstr "" msgstr ""
@ -570,71 +526,222 @@ msgstr ""
msgid "Incorrect value for %s: %s" msgid "Incorrect value for %s: %s"
msgstr "" msgstr ""
#: sabnzbd/misc.py:319 #: sabnzbd/misc.py:320
msgid "Cannot create directory %s" msgid "Cannot create directory %s"
msgstr "" msgstr ""
#: sabnzbd/misc.py:325 #: sabnzbd/misc.py:326
msgid "%s directory: %s error accessing" msgid "%s directory: %s error accessing"
msgstr "" msgstr ""
#: sabnzbd/misc.py:345 #: sabnzbd/misc.py:346
msgid "Cannot connect to registry hive HKEY_CURRENT_USER." msgid "Cannot connect to registry hive HKEY_CURRENT_USER."
msgstr "" msgstr ""
#: sabnzbd/misc.py:352 #: sabnzbd/misc.py:353
msgid "Cannot open registry key \"%s\"." msgid "Cannot open registry key \"%s\"."
msgstr "" msgstr ""
#: sabnzbd/misc.py:379 #: sabnzbd/misc.py:380
msgid "Failed to read registry keys for special folders" msgid "Failed to read registry keys for special folders"
msgstr "" msgstr ""
#: sabnzbd/misc.py:612 #: sabnzbd/misc.py:465
msgid ""
"\n"
" <html>\n"
" <head>\n"
" <title>Problem with %s %s</title>\n"
" </head>\n"
" <body>\n"
" <h1><font color=\"#0000FF\">Welcome to %s %s</font></h1>\n"
" <p align=\"center\">&nbsp;</p>\n"
" <p align=\"center\"><font size=\"5\">\n"
" <blockquote>\n"
" %s\n"
" </blockquote>\n"
" <br>%s<br>\n"
" </body>\n"
"</html>\n"
msgstr ""
#: sabnzbd/misc.py:483
msgid ""
"\n"
" SABnzbd is not compatible with some software firewalls.<br>\n"
" %s<br>\n"
" Sorry, but we cannot solve this incompatibility right now.<br>\n"
" Please file a complaint at your firewall supplier.<br>\n"
" <br>\n"
msgstr ""
#: sabnzbd/misc.py:492
msgid ""
"\n"
" SABnzbd needs a free tcp/ip port for its internal web server.<br>\n"
" Port %s on %s was tried , but it is not available.<br>\n"
" Some other software uses the port or SABnzbd is already running.<br>\n"
" <br>\n"
" Please restart SABnzbd with a different port number.<br>\n"
" <br>\n"
" %s<br>\n"
" &nbsp;&nbsp;&nbsp;&nbsp;%s --server %s:%s<br>\n"
" <br>\n"
" If you get this error message again, please try a different number.<br>\n"
msgstr ""
#: sabnzbd/misc.py:506
msgid ""
"\n"
" SABnzbd needs a free tcp/ip port for its internal web server.<br>\n"
" Port %s on %s was tried , but the account used for SABnzbd has no permission to use it.<br>\n"
" On OSX and Linux systems, normal users must use ports above 1023.<br>\n"
" <br>\n"
" Please restart SABnzbd with a different port number.<br>\n"
" <br>\n"
" %s<br>\n"
" &nbsp;&nbsp;&nbsp;&nbsp;%s --server %s:%s<br>\n"
" <br>\n"
" If you get this error message again, please try a different number.<br>\n"
msgstr ""
#: sabnzbd/misc.py:520
msgid ""
"\n"
" SABnzbd needs a valid host address for its internal web server.<br>\n"
" You have specified an invalid address.<br>\n"
" Safe values are <b>localhost</b> and <b>0.0.0.0</b><br>\n"
" <br>\n"
" Please restart SABnzbd with a proper host address.<br>\n"
" <br>\n"
" %s<br>\n"
" &nbsp;&nbsp;&nbsp;&nbsp;%s --server %s:%s<br>\n"
" <br>\n"
msgstr ""
#: sabnzbd/misc.py:533
msgid ""
"\n"
" SABnzbd detected saved data from an other SABnzbd version<br>\n"
" but cannot re-use the data of the other program.<br><br>\n"
" You may want to finish your queue first with the other program.<br><br>\n"
" After that, start this program with the \"--clean\" option.<br>\n"
" This will erase the current queue and history!<br>\n"
" SABnzbd read the file \"%s\".<br>\n"
" <br>\n"
" %s<br>\n"
" &nbsp;&nbsp;&nbsp;&nbsp;%s --clean<br>\n"
" <br>\n"
msgstr ""
#: sabnzbd/misc.py:547
msgid ""
"\n"
" SABnzbd cannot find its web interface files in %s.<br>\n"
" Please install the program again.<br>\n"
" <br>\n"
msgstr ""
#: sabnzbd/misc.py:554
msgid ""
"\n"
" SABnzbd detected a fatal error:<br>\n"
" %s<br><br>\n"
" %s<br>\n"
msgstr ""
#: sabnzbd/misc.py:561
msgid ""
"\n"
" SABnzbd detected a Queue and History from an older (0.4.x) release.<br><br>\n"
" Both queue and history will be ignored and may get lost!<br><br>\n"
" You may choose to stop SABnzbd and finish the queue with the older program.<br><br>\n"
" Click OK to continue to SABnzbd<br><br>\n"
" <FORM><input type=\"button\" onclick=\"this.form.action='/.'; this.form.submit(); return false;\" value=\"OK\"/></FORM>\n"
msgstr ""
#: sabnzbd/misc.py:570
msgid ""
"\n"
" SABnzbd detected that the file sqlite3.dll is missing.<br><br>\n"
" Some poorly designed virus-scanners remove this file.<br>\n"
" Please check your virus-scanner, try to re-install SABnzbd and complain to your virus-scanner vendor.<br>\n"
" <br>\n"
msgstr ""
#: sabnzbd/misc.py:581
msgid "Press Startkey+R and type the line (example):"
msgstr ""
#: sabnzbd/misc.py:584
msgid "Open a Terminal window and type the line (example):"
msgstr ""
#: sabnzbd/misc.py:604
msgid "It is likely that you are using ZoneAlarm on Vista.<br>"
msgstr ""
#: sabnzbd/misc.py:615
msgid "Program did not start!"
msgstr ""
#: sabnzbd/misc.py:640
msgid "You have no permisson to use port %s" msgid "You have no permisson to use port %s"
msgstr "" msgstr ""
#: sabnzbd/misc.py:646 #: sabnzbd/misc.py:656
msgid "Fatal error"
msgstr ""
#: sabnzbd/misc.py:674
msgid "Cannot launch the browser, probably not found" msgid "Cannot launch the browser, probably not found"
msgstr "" msgstr ""
#: sabnzbd/misc.py:921 #: sabnzbd/misc.py:680
msgid "Access denied"
msgstr ""
#: sabnzbd/misc.py:681
msgid "Error %s: You need to provide a valid username and password."
msgstr ""
#: sabnzbd/misc.py:951
msgid "Failed making (%s)" msgid "Failed making (%s)"
msgstr "" msgstr ""
#: sabnzbd/misc.py:946 #: sabnzbd/misc.py:976
msgid "Failed moving %s to %s" msgid "Failed moving %s to %s"
msgstr "" msgstr ""
#: sabnzbd/misc.py:1058 #: sabnzbd/misc.py:1088
msgid "Unusable NZB file" msgid "Unusable NZB file"
msgstr "" msgstr ""
#: sabnzbd/misc.py:1069 #: sabnzbd/misc.py:1099
msgid "Try again" msgid "Try again"
msgstr "" msgstr ""
#: sabnzbd/misc.py:1069 #: sabnzbd/misc.py:1099
msgid "URL Fetching failed; %s" msgid "URL Fetching failed; %s"
msgstr "" msgstr ""
#: sabnzbd/misc.py:1199 #: sabnzbd/misc.py:1229
msgid "pyopenssl module missing, please install for https access" msgid "pyopenssl module missing, please install for https access"
msgstr "" msgstr ""
#: sabnzbd/misc.py:1218 #: sabnzbd/misc.py:1248
msgid "Error creating SSL key and certificate" msgid "Error creating SSL key and certificate"
msgstr "" msgstr ""
#: sabnzbd/misc.py:1288 #: sabnzbd/misc.py:1318
msgid "Failed to hibernate system" msgid "Failed to hibernate system"
msgstr "" msgstr ""
#: sabnzbd/misc.py:1297 sabnzbd/misc.py:1334 #: sabnzbd/misc.py:1327 sabnzbd/misc.py:1364
msgid "Failed to standby system" msgid "Failed to standby system"
msgstr "" msgstr ""
#: sabnzbd/misc.py:1324 #: sabnzbd/misc.py:1354
msgid "Error while shutting down system" msgid "Error while shutting down system"
msgstr "" msgstr ""
@ -1008,19 +1115,19 @@ msgstr ""
msgid "Could not compile regex: %s" msgid "Could not compile regex: %s"
msgstr "" msgstr ""
#: sabnzbd/rss.py:201 sabnzbd/rss.py:203 #: sabnzbd/rss.py:200 sabnzbd/rss.py:202
msgid "Incorrect RSS feed description \"%s\"" msgid "Incorrect RSS feed description \"%s\""
msgstr "" msgstr ""
#: sabnzbd/rss.py:252 sabnzbd/rss.py:253 #: sabnzbd/rss.py:251 sabnzbd/rss.py:252
msgid "Failed to retrieve RSS from %s" msgid "Failed to retrieve RSS from %s"
msgstr "" msgstr ""
#: sabnzbd/rss.py:257 sabnzbd/rss.py:258 #: sabnzbd/rss.py:256 sabnzbd/rss.py:257
msgid "Failed to retrieve RSS from %s: %s" msgid "Failed to retrieve RSS from %s: %s"
msgstr "" msgstr ""
#: sabnzbd/rss.py:547 #: sabnzbd/rss.py:543
msgid "Empty RSS entry found (%s)" msgid "Empty RSS entry found (%s)"
msgstr "" msgstr ""
@ -1685,7 +1792,7 @@ msgid "HTTPS Port"
msgstr "" msgstr ""
#: sabnzbd/skintext.py:246 #: sabnzbd/skintext.py:246
msgid "Port SABnzbd should listen on for HTTPS communication." msgid "If empty, the standard port will only listen to HTTPS."
msgstr "" msgstr ""
#: sabnzbd/skintext.py:247 #: sabnzbd/skintext.py:247
@ -2911,7 +3018,7 @@ msgid "Pause for..."
msgstr "" msgstr ""
#: sabnzbd/skintext.py:629 #: sabnzbd/skintext.py:629
msgid "Toggle Multi-Operations" msgid "Multi-Operations"
msgstr "" msgstr ""
#: sabnzbd/skintext.py:630 #: sabnzbd/skintext.py:630
@ -3306,3 +3413,47 @@ msgstr ""
msgid "Invalid nzbmatrix report number %s" msgid "Invalid nzbmatrix report number %s"
msgstr "" msgstr ""
#: sabnzbd/utils/servertests.py:35
msgid "The hostname is not set."
msgstr ""
#: sabnzbd/utils/servertests.py:40
msgid "There are no connections set. Please set at least one connection."
msgstr ""
#: sabnzbd/utils/servertests.py:67
msgid "Password masked in ******, please re-enter"
msgstr ""
#: sabnzbd/utils/servertests.py:71
msgid "Invalid server details"
msgstr ""
#: sabnzbd/utils/servertests.py:83
msgid "Timed out: Try enabling SSL or connecting on a different port."
msgstr ""
#: sabnzbd/utils/servertests.py:85
msgid "Timed out"
msgstr ""
#: sabnzbd/utils/servertests.py:105
msgid "Server requires username and password."
msgstr ""
#: sabnzbd/utils/servertests.py:108
msgid "Connection Successful!"
msgstr ""
#: sabnzbd/utils/servertests.py:111
msgid "Authentication failed, check username/password."
msgstr ""
#: sabnzbd/utils/servertests.py:114
msgid "Too many connections, please pause downloading or try again later"
msgstr ""
#: sabnzbd/utils/servertests.py:117
msgid "Could not determine connection result (%s)"
msgstr ""

86
sabnzbd/misc.py

@ -461,7 +461,8 @@ def set_serv_parms(service, args):
# including panic messages # including panic messages
# #
################################################################################ ################################################################################
MSG_BAD_NEWS = r''' def MSG_BAD_NEWS():
return Ta(r'''
<html> <html>
<head> <head>
<title>Problem with %s %s</title> <title>Problem with %s %s</title>
@ -476,17 +477,19 @@ MSG_BAD_NEWS = r'''
<br>%s<br> <br>%s<br>
</body> </body>
</html> </html>
''' ''')
MSG_BAD_FWALL = r''' def MSG_BAD_FWALL():
return Ta(r'''
SABnzbd is not compatible with some software firewalls.<br> SABnzbd is not compatible with some software firewalls.<br>
%s<br> %s<br>
Sorry, but we cannot solve this incompatibility right now.<br> Sorry, but we cannot solve this incompatibility right now.<br>
Please file a complaint at your firewall supplier.<br> Please file a complaint at your firewall supplier.<br>
<br> <br>
''' ''')
MSG_BAD_PORT = r''' def MSG_BAD_PORT():
return Ta(r'''
SABnzbd needs a free tcp/ip port for its internal web server.<br> SABnzbd needs a free tcp/ip port for its internal web server.<br>
Port %s on %s was tried , but it is not available.<br> Port %s on %s was tried , but it is not available.<br>
Some other software uses the port or SABnzbd is already running.<br> Some other software uses the port or SABnzbd is already running.<br>
@ -497,9 +500,10 @@ MSG_BAD_PORT = r'''
&nbsp;&nbsp;&nbsp;&nbsp;%s --server %s:%s<br> &nbsp;&nbsp;&nbsp;&nbsp;%s --server %s:%s<br>
<br> <br>
If you get this error message again, please try a different number.<br> If you get this error message again, please try a different number.<br>
''' ''')
MSG_ILL_PORT = r''' def MSG_ILL_PORT():
return Ta(r'''
SABnzbd needs a free tcp/ip port for its internal web server.<br> SABnzbd needs a free tcp/ip port for its internal web server.<br>
Port %s on %s was tried , but the account used for SABnzbd has no permission to use it.<br> Port %s on %s was tried , but the account used for SABnzbd has no permission to use it.<br>
On OSX and Linux systems, normal users must use ports above 1023.<br> On OSX and Linux systems, normal users must use ports above 1023.<br>
@ -510,9 +514,10 @@ MSG_ILL_PORT = r'''
&nbsp;&nbsp;&nbsp;&nbsp;%s --server %s:%s<br> &nbsp;&nbsp;&nbsp;&nbsp;%s --server %s:%s<br>
<br> <br>
If you get this error message again, please try a different number.<br> If you get this error message again, please try a different number.<br>
''' ''')
MSG_BAD_HOST = r''' def MSG_BAD_HOST():
return Ta(r'''
SABnzbd needs a valid host address for its internal web server.<br> SABnzbd needs a valid host address for its internal web server.<br>
You have specified an invalid address.<br> You have specified an invalid address.<br>
Safe values are <b>localhost</b> and <b>0.0.0.0</b><br> Safe values are <b>localhost</b> and <b>0.0.0.0</b><br>
@ -522,9 +527,10 @@ MSG_BAD_HOST = r'''
%s<br> %s<br>
&nbsp;&nbsp;&nbsp;&nbsp;%s --server %s:%s<br> &nbsp;&nbsp;&nbsp;&nbsp;%s --server %s:%s<br>
<br> <br>
''' ''')
MSG_BAD_QUEUE = r''' def MSG_BAD_QUEUE():
return Ta(r'''
SABnzbd detected saved data from an other SABnzbd version<br> SABnzbd detected saved data from an other SABnzbd version<br>
but cannot re-use the data of the other program.<br><br> but cannot re-use the data of the other program.<br><br>
You may want to finish your queue first with the other program.<br><br> You may want to finish your queue first with the other program.<br><br>
@ -535,74 +541,78 @@ MSG_BAD_QUEUE = r'''
%s<br> %s<br>
&nbsp;&nbsp;&nbsp;&nbsp;%s --clean<br> &nbsp;&nbsp;&nbsp;&nbsp;%s --clean<br>
<br> <br>
''' ''')
MSG_BAD_TEMPL = r''' def MSG_BAD_TEMPL():
return Ta(r'''
SABnzbd cannot find its web interface files in %s.<br> SABnzbd cannot find its web interface files in %s.<br>
Please install the program again.<br> Please install the program again.<br>
<br> <br>
''' ''')
MSG_OTHER = r''' def MSG_OTHER():
return Ta(r'''
SABnzbd detected a fatal error:<br> SABnzbd detected a fatal error:<br>
%s<br><br> %s<br><br>
%s<br> %s<br>
''' ''')
MSG_OLD_QUEUE = r''' def MSG_OLD_QUEUE():
return Ta(r'''
SABnzbd detected a Queue and History from an older (0.4.x) release.<br><br> SABnzbd detected a Queue and History from an older (0.4.x) release.<br><br>
Both queue and history will be ignored and may get lost!<br><br> Both queue and history will be ignored and may get lost!<br><br>
You may choose to stop SABnzbd and finish the queue with the older program.<br><br> You may choose to stop SABnzbd and finish the queue with the older program.<br><br>
Click OK to continue to SABnzbd<br><br> Click OK to continue to SABnzbd<br><br>
<FORM><input type="button" onclick="this.form.action='/.'; this.form.submit(); return false;" value="OK"/></FORM> <FORM><input type="button" onclick="this.form.action='/.'; this.form.submit(); return false;" value="OK"/></FORM>
''' ''')
MSG_SQLITE = r''' def MSG_SQLITE():
return Ta(r'''
SABnzbd detected that the file sqlite3.dll is missing.<br><br> SABnzbd detected that the file sqlite3.dll is missing.<br><br>
Some poorly designed virus-scanners remove this file.<br> Some poorly designed virus-scanners remove this file.<br>
Please check your virus-scanner, try to re-install SABnzbd and complain to your virus-scanner vendor.<br> Please check your virus-scanner, try to re-install SABnzbd and complain to your virus-scanner vendor.<br>
<br> <br>
''' ''')
def panic_message(panic, a=None, b=None): def panic_message(panic, a=None, b=None):
"""Create the panic message from templates """Create the panic message from templates
""" """
if sabnzbd.WIN32: if sabnzbd.WIN32:
os_str = 'Press Startkey+R and type the line (example):' os_str = Ta('Press Startkey+R and type the line (example):')
prog_path = '"%s"' % sabnzbd.MY_FULLNAME prog_path = '"%s"' % sabnzbd.MY_FULLNAME
else: else:
os_str = 'Open a Terminal window and type the line (example):' os_str = Ta('Open a Terminal window and type the line (example):')
prog_path = sabnzbd.MY_FULLNAME prog_path = sabnzbd.MY_FULLNAME
if panic == PANIC_PORT: if panic == PANIC_PORT:
newport = int(b) + 1 newport = int(b) + 1
newport = "%s" % newport newport = "%s" % newport
msg = MSG_BAD_PORT % (b, a, os_str, prog_path, a, newport) msg = MSG_BAD_PORT() % (b, a, os_str, prog_path, a, newport)
elif panic == PANIC_XPORT: elif panic == PANIC_XPORT:
if int(b) < 1023: if int(b) < 1023:
newport = 1024 newport = 1024
else: else:
newport = int(b) + 1 newport = int(b) + 1
newport = "%s" % newport newport = "%s" % newport
msg = MSG_ILL_PORT % (b, a, os_str, prog_path, a, newport) msg = MSG_ILL_PORT() % (b, a, os_str, prog_path, a, newport)
elif panic == PANIC_TEMPL: elif panic == PANIC_TEMPL:
msg = MSG_BAD_TEMPL % a msg = MSG_BAD_TEMPL() % a
elif panic == PANIC_QUEUE: elif panic == PANIC_QUEUE:
msg = MSG_BAD_QUEUE % (a, os_str, prog_path) msg = MSG_BAD_QUEUE() % (a, os_str, prog_path)
elif panic == PANIC_FWALL: elif panic == PANIC_FWALL:
if a: if a:
msg = MSG_BAD_FWALL % "It is likely that you are using ZoneAlarm on Vista.<br>" msg = MSG_BAD_FWALL() % Ta('It is likely that you are using ZoneAlarm on Vista.<br>')
else: else:
msg = MSG_BAD_FWALL % "<br>" msg = MSG_BAD_FWALL() % "<br>"
elif panic == PANIC_SQLITE: elif panic == PANIC_SQLITE:
msg = MSG_SQLITE msg = MSG_SQLITE()
elif panic == PANIC_HOST: elif panic == PANIC_HOST:
msg = MSG_BAD_HOST % (os_str, prog_path, 'localhost', b) msg = MSG_BAD_HOST() % (os_str, prog_path, 'localhost', b)
else: else:
msg = MSG_OTHER % (a, b) msg = MSG_OTHER() % (a, b)
msg = MSG_BAD_NEWS % (sabnzbd.MY_NAME, sabnzbd.__version__, sabnzbd.MY_NAME, sabnzbd.__version__, msg = MSG_BAD_NEWS() % (sabnzbd.MY_NAME, sabnzbd.__version__, sabnzbd.MY_NAME, sabnzbd.__version__,
msg, 'Program did not start!') msg, Ta('Program did not start!'))
if sabnzbd.WIN_SERVICE: if sabnzbd.WIN_SERVICE:
sabnzbd.WIN_SERVICE.ErrLogger('Panic exit', msg) sabnzbd.WIN_SERVICE.ErrLogger('Panic exit', msg)
@ -643,7 +653,7 @@ def panic_old_queue():
return MSG_BAD_NEWS % (sabnzbd.MY_NAME, sabnzbd.__version__, sabnzbd.MY_NAME, sabnzbd.__version__, msg, '') return MSG_BAD_NEWS % (sabnzbd.MY_NAME, sabnzbd.__version__, sabnzbd.MY_NAME, sabnzbd.__version__, msg, '')
def panic(reason, remedy=""): def panic(reason, remedy=""):
print "\nFatal error:\n %s\n%s" % (reason, remedy) print "\n%s:\n %s\n%s" % (Ta('Fatal error'), reason, remedy)
launch_a_browser(panic_message(PANIC_OTHER, reason, remedy)) launch_a_browser(panic_message(PANIC_OTHER, reason, remedy))
@ -667,17 +677,19 @@ def launch_a_browser(url, force=False):
def error_page_401(status, message, traceback, version): def error_page_401(status, message, traceback, version):
""" Custom handler for 401 error """ """ Custom handler for 401 error """
title = T('Access denied')
body = T('Error %s: You need to provide a valid username and password.') % status
return r''' return r'''
<html> <html>
<head> <head>
<title>Access denied</title> <title>%s</title>
</head> </head>
<body> <body>
<br/><br/> <br/><br/>
<font color="#0000FF">Error %s: You need to provide a valid username and password.</font> <font color="#0000FF">%s</font>
</body> </body>
</html> </html>
''' % status ''' % (title, body)

Loading…
Cancel
Save