[Pywikipedia-l] SVN: [4944] trunk/pywikipedia

btongminh at svn.wikimedia.org btongminh at svn.wikimedia.org
Sun Jan 27 18:14:26 UTC 2008


Revision: 4944
Author:   btongminh
Date:     2008-01-27 18:14:25 +0000 (Sun, 27 Jan 2008)

Log Message:
-----------
Make socket_timeout a config setting. Also make a note in the documentation that persistent_http has been disabled.

Modified Paths:
--------------
    trunk/pywikipedia/config.py
    trunk/pywikipedia/wikipedia.py

Modified: trunk/pywikipedia/config.py
===================================================================
--- trunk/pywikipedia/config.py	2008-01-27 16:09:57 UTC (rev 4943)
+++ trunk/pywikipedia/config.py	2008-01-27 18:14:25 UTC (rev 4944)
@@ -365,8 +365,13 @@
 # Use a persistent http connection. An http connection has to be established
 # only once per site object, making stuff a whole lot faster. Do NOT EVER
 # use this if you share Site objects across threads without proper locking.
+## DISABLED FUNCTION. Setting this variable will not have any effect.
 persistent_http = False
 
+# Default socket timeout. Set to None to disable timeouts.
+socket_timeout = 120  # set a pretty long timeout just in case...
+
+
 ############## FURTHER SETTINGS ##############
 
 # The bot can make some additional changes to each page it edits, e.g. fix

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2008-01-27 16:09:57 UTC (rev 4943)
+++ trunk/pywikipedia/wikipedia.py	2008-01-27 18:14:25 UTC (rev 4944)
@@ -113,7 +113,6 @@
 
 import os, sys
 import httplib, socket, urllib
-socket.setdefaulttimeout(120)  # set a pretty long timeout just in case...
 import traceback
 import time, threading, Queue
 import math
@@ -5270,6 +5269,8 @@
 """)
     sys.exit(1)
 
+# Set socket timeout
+socket.setdefaulttimeout(config.socket_timeout) 
 
 # Languages to use for comment text after the actual language but before
 # en:. For example, if for language 'xx', you want the preference of





More information about the Pywikipedia-l mailing list