Changeset 8a6ec7
- Timestamp:
- 11/22/2009 02:34:51 AM (15 years ago)
- Branches:
- 2.0.x, develop, extjs4-port, master
- Children:
- 1b7a50
- Parents:
- 535940
- Location:
- deluge
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
deluge/component.py
r535940 r8a6ec7 102 102 self.depend[name] = depend 103 103 104 def deregister(self, name): 105 """Deregisters a component""" 106 if name in self.components: 107 log.debug("Deregistering Component: %s", name) 108 self.stop_component(name) 109 del self.components[name] 110 104 111 def get(self, name): 105 112 """Returns a reference to the component 'name'""" … … 127 134 def stop(self): 128 135 """Stops all components""" 129 for component in self.components.keys(): 130 self.stop_component(component) 136 # We create a separate list of the keys and do an additional check to 137 # make sure the key still exists in the components dict. 138 # This is because components could be deregistered during a stop and 139 # the dictionary would get modified while iterating through it. 140 components = self.components.keys() 141 for component in components: 142 if component in self.components: 143 self.stop_component(component) 131 144 132 145 def stop_component(self, component): … … 188 201 _ComponentRegistry.register(name, obj, depend) 189 202 203 def deregister(name): 204 """Deregisters a component""" 205 _ComponentRegistry.deregister(name) 206 190 207 def start(component=None): 191 208 """Starts all components""" -
deluge/core/rpcserver.py
r535940 r8a6ec7 132 132 request = rencode.loads(dobj.decompress(data)) 133 133 except Exception, e: 134 log.debug("Received possible invalid message (%r): %s", data, e)134 #log.debug("Received possible invalid message (%r): %s", data, e) 135 135 # This could be cut-off data, so we'll save this in the buffer 136 136 # and try to prepend it on the next dataReceived() -
deluge/core/torrentmanager.py
r535940 r8a6ec7 211 211 def stop(self): 212 212 # Stop timers 213 self.save_state_timer.stop() 214 self.save_resume_data_timer.stop() 213 if self.save_state_timer.running: 214 self.save_state_timer.stop() 215 216 if self.save_resume_data_timer.running: 217 self.save_resume_data_timer.stop() 215 218 216 219 # Save state on shutdown -
deluge/event.py
r535940 r8a6ec7 42 42 """ 43 43 44 event_list = [] 45 46 class DelugeEventMetaClass(type): 47 """ 48 This metaclass simply keeps a list of all events classes created. 49 """ 50 def __init__(cls, name, bases, dct): 51 event_list.append(name) 52 super(DelugeEventMetaClass, cls).__init__(name, bases, dct) 53 44 54 class DelugeEvent(object): 45 55 """ … … 50 60 51 61 """ 62 __metaclass__ = DelugeEventMetaClass 63 52 64 def _get_name(self): 53 65 return self.__class__.__name__ -
deluge/pluginmanagerbase.py
r535940 r8a6ec7 88 88 # Disable all plugins that are enabled 89 89 for key in self.plugins.keys(): 90 self. plugins[key].disable()90 self.disable_plugin(key) 91 91 92 92 def __getitem__(self, key): … … 154 154 try: 155 155 self.plugins[name].disable() 156 component.deregister(self.plugins[name].plugin.get_component_name()) 156 157 del self.plugins[name] 157 158 self.config["enabled_plugins"].remove(name) -
deluge/plugins/blocklist/blocklist/common.py
r535940 r8a6ec7 50 50 return new 51 51 return safer 52 53 def remove_zeros(ip): 54 """ 55 Removes unneeded zeros from ip addresses. 56 57 Example: 000.000.000.003 -> 0.0.0.3 58 59 :param ip: the ip address 60 :type ip: string 61 62 :returns: the ip address without the unneeded zeros 63 :rtype: string 64 65 """ 66 return ".".join([part.lstrip("0").zfill(1) for part in ip.split(".")]) -
deluge/plugins/blocklist/blocklist/core.py
r535940 r8a6ec7 129 129 self.failed_attempts = 0 130 130 self.auto_detected = False 131 if force: 132 self.reader = None 131 133 132 134 # Start callback chain … … 219 221 headers['If-Modified-Since'] = self.config["last_update"] 220 222 221 log.debug("Attempting to download blocklist %s" %url)222 log.debug("Sending headers: %s" %headers)223 log.debug("Attempting to download blocklist %s", url) 224 log.debug("Sending headers: %s", headers) 223 225 self.up_to_date = False 224 226 self.is_downloading = True … … 240 242 location = error_msg.split(" to ")[1] 241 243 if "Moved Permanently" in error_msg: 242 log.debug("Setting blocklist url to %s" %location)244 log.debug("Setting blocklist url to %s", location) 243 245 self.config["url"] = location 244 246 f.trap(f.type) … … 292 294 self.auto_detected = True 293 295 294 log.debug("Importing using reader: %s", self.reader)296 log.debug("Importing using reader: %s", self.reader) 295 297 log.debug("Reader type: %s compression: %s", self.config["list_type"], self.config["list_compression"]) 296 298 d = threads.deferToThread(self.reader(blocklist).read, on_read_ip_range) … … 328 330 # If we have a backup and we haven't already used it 329 331 e = f.trap(Exception) 330 log.warning("Error reading blocklist: ", e)332 log.warning("Error reading blocklist: %s", e) 331 333 self.use_cache = True 332 334 try_again = True … … 348 350 self.config["list_compression"] = detect_compression(blocklist) 349 351 self.config["list_type"] = detect_format(blocklist, self.config["list_compression"]) 350 log.debug("Auto-detected type: %s compression: %s", self.config["list_type"], 352 log.debug("Auto-detected type: %s compression: %s", self.config["list_type"], self.config["list_compression"]) 351 353 if not self.config["list_type"]: 352 354 self.config["list_compression"] = "" -
deluge/plugins/blocklist/blocklist/detect.py
r535940 r8a6ec7 78 78 if decompressor: 79 79 reader = decompressor(reader) 80 81 80 return reader -
deluge/plugins/blocklist/blocklist/readers.py
r535940 r8a6ec7 34 34 # 35 35 36 from deluge.log import LOG as log37 from common import raiseError 36 from common import raiseError, remove_zeros 37 import re 38 38 39 def remove_zeros(ip):40 """41 Removes unneeded zeros from ip addresses.42 43 Example: 000.000.000.003 -> 0.0.0.344 45 :param ip: the ip address46 :type ip: string47 48 :returns: the ip address without the unneeded zeros49 :rtype: string50 51 """52 new_ip = []53 for part in ip.split("."):54 while part[0] == "0" and len(part) > 1:55 part = part[1:]56 new_ip.append(part)57 return ".".join(new_ip)58 59 39 class ReaderParseError(Exception): 60 40 pass … … 91 71 try: 92 72 (start, end) = self.parse(line) 73 if not re.match("^(\d{1,3}\.){4}$", start + ".") or \ 74 not re.match("^(\d{1,3}\.){4}$", end + "."): 75 valid = False 93 76 except: 94 77 valid = False … … 116 99 @raiseError(ReaderParseError) 117 100 def parse(self, line): 118 return line.strip().split(":")[ 1].split("-")101 return line.strip().split(":")[-1].split("-") 119 102 120 103 class PeerGuardianReader(SafePeerReader): -
deluge/ui/console/main.py
r535940 r8a6ec7 250 250 """ 251 251 self.batch_write = batch 252 if not batch :252 if not batch and self.interactive: 253 253 self.screen.refresh() 254 254 -
deluge/ui/gtkui/common.py
r535940 r8a6ec7 35 35 36 36 """Common functions for various parts of gtkui to use.""" 37 38 import os 37 39 38 40 import pygtk -
deluge/ui/gtkui/glade/add_torrent_dialog.glade
r535940 r8a6ec7 4 4 <!-- interface-naming-policy toplevel-contextual --> 5 5 <widget class="GtkDialog" id="dialog_add_torrent"> 6 <property name="height_request">560</property>7 6 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 8 7 <property name="border_width">5</property> … … 15 14 <property name="visible">True</property> 16 15 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 16 <property name="orientation">vertical</property> 17 17 <property name="spacing">2</property> 18 18 <child> … … 21 21 <property name="can_focus">True</property> 22 22 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 23 <property name="orientation">vertical</property> 23 24 <child> 24 25 <widget class="GtkFrame" id="frame2"> … … 38 39 <property name="visible">True</property> 39 40 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 41 <property name="orientation">vertical</property> 40 42 <child> 41 43 <widget class="GtkScrolledWindow" id="scrolledwindow1"> … … 346 348 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 347 349 <property name="border_width">5</property> 350 <property name="orientation">vertical</property> 348 351 <property name="spacing">5</property> 349 352 <child> … … 426 429 <property name="visible">True</property> 427 430 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 431 <property name="orientation">vertical</property> 428 432 <child> 429 433 <widget class="GtkRadioButton" id="radio_full"> … … 658 662 <property name="visible">True</property> 659 663 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 664 <property name="orientation">vertical</property> 660 665 <property name="spacing">5</property> 661 666 <child> … … 902 907 </widget> 903 908 <packing> 909 <property name="expand">False</property> 910 <property name="fill">False</property> 904 911 <property name="position">0</property> 905 912 </packing> … … 916 923 </widget> 917 924 <packing> 925 <property name="expand">False</property> 926 <property name="fill">False</property> 918 927 <property name="position">1</property> 919 928 </packing> … … 943 952 <property name="visible">True</property> 944 953 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 954 <property name="orientation">vertical</property> 945 955 <property name="spacing">2</property> 946 956 <child> … … 948 958 <property name="visible">True</property> 949 959 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 960 <property name="orientation">vertical</property> 950 961 <property name="spacing">5</property> 951 962 <child> … … 1054 1065 </widget> 1055 1066 <packing> 1067 <property name="expand">False</property> 1068 <property name="fill">False</property> 1056 1069 <property name="position">0</property> 1057 1070 </packing> … … 1070 1083 </widget> 1071 1084 <packing> 1085 <property name="expand">False</property> 1086 <property name="fill">False</property> 1072 1087 <property name="position">1</property> 1073 1088 </packing> … … 1097 1112 <property name="visible">True</property> 1098 1113 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 1114 <property name="orientation">vertical</property> 1099 1115 <property name="spacing">2</property> 1100 1116 <child> … … 1102 1118 <property name="visible">True</property> 1103 1119 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 1120 <property name="orientation">vertical</property> 1104 1121 <property name="spacing">5</property> 1105 1122 <child> … … 1247 1264 </widget> 1248 1265 <packing> 1266 <property name="expand">False</property> 1267 <property name="fill">False</property> 1249 1268 <property name="position">0</property> 1250 1269 </packing> … … 1263 1282 </widget> 1264 1283 <packing> 1284 <property name="expand">False</property> 1285 <property name="fill">False</property> 1265 1286 <property name="position">1</property> 1266 1287 </packing> -
deluge/ui/gtkui/gtkui.py
r535940 r8a6ec7 310 310 _("Error Starting Daemon"), 311 311 _("There was an error starting the daemon process. Try running it from a console to see if there is an error.")).run() 312 313 # We'll try 30 reconnects at 500ms intervals 314 try_counter = 30 315 312 316 313 def on_connect(connector): 317 314 component.start() … … 324 321 import time 325 322 time.sleep(0.5) 326 do_connect( )323 do_connect(try_counter) 327 324 return result 328 329 def do_connect( ):325 326 def do_connect(try_counter): 330 327 client.connect(*host[1:]).addCallback(on_connect).addErrback(on_connect_fail, try_counter) 331 328 332 329 if try_connect: 333 do_connect( )334 330 do_connect(6) 331 break 335 332 336 333 if self.config["show_connection_manager_on_start"]: -
deluge/ui/gtkui/ipcinterface.py
r535940 r8a6ec7 36 36 37 37 import sys 38 import os .path38 import os 39 39 import base64 40 40 … … 105 105 sys.exit(0) 106 106 else: 107 lockfile = socket + ".lock" 108 log.debug("Checking if lockfile exists: %s", lockfile) 109 if os.path.lexists(lockfile): 110 try: 111 os.kill(int(os.readlink(lockfile)), 0) 112 except OSError: 113 log.debug("Removing lockfile since it's stale.") 114 try: 115 os.remove(lockfile) 116 os.remove(socket) 117 except Exception, e: 118 log.error("Problem deleting lockfile or socket file!") 119 log.exception(e) 120 107 121 try: 108 122 self.factory = Factory() -
deluge/ui/web/index.html
r535940 r8a6ec7 2 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 3 <head> 4 <title>Deluge: Web UI (alpha)${version}</title>4 <title>Deluge: Web UI ${version}</title> 5 5 6 6 <link rel="shortcut icon" href="/icons/deluge.png" type="image/png" />
Note:
See TracChangeset
for help on using the changeset viewer.