Update of /cvsroot/wpdev/xmlscripts/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv23429
Modified Files:
webadmin.py
Added Files:
lock.py
Log Message:
This should fix the annoying webadmin startup problems.
--- NEW FILE: lock.py ---
#
# Event for Locking Items
#
def onUse( char, item ):
events = item.events
if not item.hastag( 'lock' ):
return 0
lock = item.gettag( 'lock' )
if lock != 'magic':
lock = int( lock )
if item.hastag( 'locked' ):
locked = int( item.gettag( 'locked' ) )
else:
locked = 0
if locked == 0:
return 0
# Search for a key in the users backpack
backpack = char.getbackpack()
if searchkey( backpack, lock ):
if 'door' in events:
char.message( 501282 ) # quickly open / relock
return 0
char.message( 502503 ) # Thats locked
return 1
Index: webadmin.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/webadmin.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** webadmin.py 13 Sep 2003 02:03:03 -0000 1.10
--- webadmin.py 8 Oct 2003 01:42:07 -0000 1.11
***************
*** 19,22 ****
--- 19,23 ----
import traceback
import web.sessions
+ import wolfpack
# Just override handle_error for nicer error handling
***************
*** 258,276 ****
thread = None
! def onLoad():
web.sessions.clear_sessions()
- # Start the Thread
global thread
thread = WebserverThread( REMOTEADMIN_PORT )
thread.start()
def onUnload():
# Stop the Thread
global thread
if thread:
-
thread.cancel()
! time.sleep( 1 )
thread.join() # Join with the thread
--- 259,285 ----
thread = None
! def onServerStart():
web.sessions.clear_sessions()
global thread
thread = WebserverThread( REMOTEADMIN_PORT )
thread.start()
+ def onLoad():
+ # Not on ServerStart
+ if not wolfpack.isstarting():
+ web.sessions.clear_sessions()
+
+ # Start the Thread
+ global thread
+ thread = WebserverThread( REMOTEADMIN_PORT )
+ thread.start()
+
def onUnload():
# Stop the Thread
global thread
if thread:
thread.cancel()
! time.sleep( 1 ) # This is needed to allow the thread to sync (Remember => global interpreter lock)
thread.join() # Join with the thread
|