Why does ThreadedAppServer.addSocketHandler() write to disk?
Steve Schwarz <[email protected]> Mon, 7 Jun 2010 15:00:59 -0500
| Newsgroups | gmane.comp.python.webware |
|---|---|
| Message-ID | <[email protected]> |
--===============0456164908997715174==
Content-Type: multipart/alternative; boundary=001636c5c011b1234404887621e3
--001636c5c011b1234404887621e3
Content-Type: text/plain; charset=ISO-8859-1
Hi,
We are looking to run multiple Webware instances from a single Webware
directory/checkout and can do so by providing configuration differences via
command line args. But I noticed that ThreadedAppServer.addSocketHandler()
creates files like http.address and adapter.address containing the
address:port for each adapter:
# write text file with server address
adrFile = self.addressFileName(handlerClass)
if os.path.exists(adrFile):
print "Warning: %s already exists" % adrFile
try:
os.unlink(adrFile)
except OSError: # we cannot remove the file
if open(adrFile).read() == adrStr:
return # same content, so never mind
else:
print "Error: Could not remove", adrFile
sys.stdout.flush()
raise
try:
f = open(adrFile, 'w')
f.write(adrStr)
f.close()
except IOError:
print "Error: Could not write", adrFile
sys.stdout.flush()
raise
Can anyone explain the purpose? Trying to stop running multiple appservers
on the same address/port? If so the port will already be bound so the
appserver will fail...
Thanks,
Steve
--001636c5c011b1234404887621e3
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi,<br>We are looking to run multiple Webware instances from a single Webwa=
re directory/checkout and can do so by providing configuration differences =
via command line args. But I noticed that ThreadedAppServer.addSocketHandle=
r() creates files like http.address and adapter.address containing the addr=
ess:port for each adapter:<br>
<br>=A0=A0=A0 =A0=A0=A0 # write text file with server address<br>=A0=A0=A0 =
=A0=A0=A0 adrFile =3D self.addressFileName(handlerClass)<br>=A0=A0=A0 =A0=
=A0=A0 if os.path.exists(adrFile):<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 print &=
quot;Warning: %s already exists" % adrFile<br>=A0=A0=A0 =A0=A0=A0 =A0=
=A0=A0 try:<br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 os.unlink(adrFile)<br>=A0=A0=A0 =A0=
=A0=A0 =A0=A0=A0 except OSError: # we cannot remove the file<br>=A0=A0=A0 =
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 if open(adrFile).read() =3D=3D adrStr:<br>=A0=
=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 return # same content, so ne=
ver mind<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 else:<br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 print "Error: Could =
not remove", adrFile<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=
=A0 sys.stdout.flush()<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=
raise<br>=A0=A0=A0 =A0=A0=A0 try:<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 f =3D o=
pen(adrFile, 'w')<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 f.write(adrStr)<=
br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 f.close()<br>=A0=A0=A0 =A0=A0=A0 except IOErr=
or:<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 print "Error: Could not write&quo=
t;, adrFile<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 sys.stdout.flush()<br>=A0=A0=
=A0 =A0=A0=A0 =A0=A0=A0 raise<br><br>Can anyone explain the purpose? Trying=
to stop running multiple appservers on the same address/port? If so the po=
rt will already be bound so the appserver will fail...<br>
<br>Thanks,<br>Steve<br>
--001636c5c011b1234404887621e3--
--===============0456164908997715174==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
--===============0456164908997715174==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Webware-discuss mailing list
Webware-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/webware-discuss
--===============0456164908997715174==--