hi there, folks:
I'd really like to release 0.7.0 but I would like it to be at least a
little bit tested before I do so. Could those of you with CVS trees check
everything out and see if it performs as advertised? Deeper bugs than
that will have to wait for the next release, but I'd at least like to know
if it works for someone other than me.
______ __ __ _____ _ _
| ____ | \_/ |_____] |_____|
|_____| |_____ | | | |
@ t w i s t e d m a t r i x . c o m
On Thursday, August 28, 2003, at 10:32 AM, itamarst CVS wrote:
> log stderr and non-zero exit code in CGIs, don't show info to users as
> it is a security risk (closes issue #241)
We shouldn't swallow errors in these situations. If it's a security
risk, provide a way for the server administrator to turn it off, but
this is a _bad_ default.
If you doubt the wisdom of making this default, please consult any
number of Perl FAQs of the form:
Q. "I wrote a CGI and it works perfectly, but now I moved it to
another server and I get nothing but a "500 Internal Server Error"
page. How do I tell what went wrong!?!?!?"
A. Look in your apache logs.
Q. "I looked at my apache logs and nothing makes sense! How do I tell
what the error was??!"
Also, could you clarify the security risk of displaying stderr from CGI
scripts? I've never heard of a CGI that puts security-critical
information on stderr rather than stdout and makes it a risk to display
I'm new to the list and I'm just starting with Twisted and Woven.
I think the framework is great, but I'm having some problems.
When I try to make two nested <div>, both with independent queries,
I get na error, the solution I've found is to create another model
called "loaddata", which does nothing, except call the queries.
If anyone knows a better way, I'd like to hear, I've searched all
over the Internet, and found nothing that could help.
Thanks in advance,
Here is the minimum working code that exemplifies it:
from twisted.web.resource import Resource
from twisted.web.woven import page
from twisted.web import microdom
from twisted.enterprise import adbapi
# When "loaddata" is not present, I get the following error:
# exceptions.AttributeError: DeferredWidget instance has no attribute 'd'
template = """
<ul model="b" view="List">
<li pattern="listItem" view="Text" />
def wmfactory_loaddata(self, request):
def wmfactory_a(self, request):
def wmfactory_b(self, request):
def runQuery(self, queryStr, attr, callback):
if not hasattr(self, attr):
dbpool = adbapi.ConnectionPool("pyPgSQL.PgSQL", "192.168.1.180::manesco_01:manesco")
deferredQuery = dbpool.runQuery(queryStr)
return getattr(self, attr)
def runAQuery(self, request):
# Sample data
#return [[1, 'Wenderson', 'WT', 2, 'Tex', None]]
return self.runQuery("SELECT * FROM advogado WHERE id_adv=77", "aDataset", self.gotAResult)
def runBQuery(self, request):
# Sample data
# [1, 'Advogado Sr.'],
# [2, 'Advogado Pleno'],
# [3, 'Advogado Jr.'],
# [4, 'Estagiario'],
# [5, 'Assist. Criatividade'],
# [6, 'Empresario'],
# [7, 'Departamento Pessoal']
return self.runQuery("SELECT * FROM categoria", "bDataset", self.gotBResult)
def gotAResult(self, data):
self.aDataset = data
def gotBResult(self, data):
self.bDataset = data
resource = A(directory = "C:\inetpub\wwwroot\man")
I have a pb with twisted.internet.utils.getProcessOutput (i never get the
output :() here is an exemple :
def wvfactory_Viewtest(self, request, node, model):
def render(self, request):
request.write('<html><body><h1>DEFTEST</h1>'+ time.asctime()+'<br >')
print "Emerge !"
d = getProcessOutput("ps")
def renderProcessOutput(self, output, request):
def renderError(self, failure, request):
request.write('it broke! (error : "'+failure.getErrorMessage()+'")')
def finishPage(self, _, request):
return "Ca marche !"
If I create a bash script with :
echo "Hello world"
the twisted code above works great. But If I use a system program like "ps" or
"emerge" , the callback is never called :(
(btw : getProcessOutput ("date") works)
In response to the question about doing serial i/o and using a select
statement, I'd like to quote from
select(iwtd, owtd, ewtd[, timeout])
This is a straightforward interface to the Unix select() system call. The
first three arguments are lists of `waitable objects': either integers
representing file descriptors or objects with a parameterless method named
fileno() returning such an integer. The three lists of waitable objects are
for input, output and `exceptional conditions', respectively. Empty lists
are allowed, but acceptance of three empty lists is platform-dependent. (It
is known to work on Unix but not on Windows.) The optional timeout argument
specifies a time-out as a floating point number in seconds. When the timeout
argument is omitted the function blocks until at least one file descriptor
is ready. A time-out value of zero specifies a poll and never blocks.
The return value is a triple of lists of objects that are ready: subsets of
the first three arguments. When the time-out is reached without a file
descriptor becoming ready, three empty lists are returned.
Among the acceptable object types in the lists are Python file objects (e.g.
sys.stdin, or objects returned by open() or os.popen()), socket objects
returned by socket.socket(). You may also define a wrapper class yourself,
as long as it has an appropriate fileno() method (that really returns a file
descriptor, not just a random integer). Note: File objects on Windows are
not acceptable, but sockets are. On Windows, the underlying select()
function is provided by the WinSock library, and does not handle file
desciptors that don't originate from WinSock.
So, select might not yet work on Windows serial ports as well as sockets.
This is also a subject of interest to me, but all I can think of is handling
the sockets via select() and polling periodically for data on the serial
port using callLater() and some win32 calls. Maybe the win32 serial port
handling could even be wrapped in a 'waitable object' as described above for
use with the Python select() call.
I recall reading somewhere that the twisted framework has the ability to
handle serial communications in connection with Global Positioning System
device interaction, but don't have any information about it. I'm going to
post this to the twisted mailing list :
Question for twisted folks: How can I add serial Windows serial port
communications as a twisted protocol? Please cross-post back to the
I just set up a new mailing list on twistedmatrix.com to discuss
interface/component systems with possible future interest in a SIG for
"integrating" (to some extent) existing Interface systems and putting
an Interface/component system into python. Even this interest is
controversial, though, I think it's mostly my own ;-)
You can subscribe at
And that page has a link to archives containing the few messages which
have been posted so far.
Twisted | Christopher Armstrong: International Man of Twistery
Radix | Release Manager, Twisted Project
-----BEGIN PGP SIGNED MESSAGE-----
I'm playing with the twisted irclogbot example .. I've no problem in the
ircnet, but it I always get disconnected from the efnet, but a eggdrop on the
same machine has no problem
[21:34:05] [connected at Thu Nov 27 21:34:05 2003]
[21:34:51] [disconnected at Thu Nov 27 21:34:51 2003 reason([Failure instance:
Traceback: twisted.internet.error.ConnectionDone, Connection was closed
I've looked at it with tcpdump and got following, but what should that tell
NOTICE AUTH :*** Looking up your hostname.
USER bla! foo bar :None
NOTICE AUTH :*** Checking Ident
NOTICE AUTH :*** Found your hostname
NOTICE AUTH :*** Got Ident response
:efnet.demon.co.uk 432 * rim! :Erroneous NERROR :Closing Link: mydnsname.com
robert dot penz at outertech dot com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
-----END PGP SIGNATURE-----
Reading the docs on the twisted web server I see that it automatically handles object publishing. But what if I want to respond to requests that aren't based on a object structure? IOW:
Client does a GET on:
in this case infodir, subdir, and doc.txt would actually be info to lookup in a database on the fly, no object structure. Is this possible?
I hope I'm explaining myself ok...
Thanx for any ideas,
P.S. I'm looking at TWISTED because it supports DB connection pooling.
I just downloaded twisted 1.1.0 forWindows and I get no response from mktap:
python %TWISTEDSCRIPTS%\mktap.py web --help
What am I doing wrong?
What is PyProtocols?
PyProtocols is an extended implementation of PEP 246, adding a new
"declaration API" that lets you easily define your own interfaces and
adapters, and declare what adapters should be used to adapt what types,
objects, or interfaces. Using PyProtocols, you can easily make flexible
frameworks that you or other developers can extend without needing to
modify the base framework. PyProtocols interfaces can interoperate with
those of Twisted and Zope, or can be used entirely standalone.
PyProtocols may be used, modified, and distributed under the same terms
and conditions as Python or Zope.
What's new in version 0.9.1?
* Implemented Samuele Pedroni's "subproto" idea (see
http://mail.python.org/pipermail/python-dev/2003-June/036242.html) as the
new 'protocolForType()' API.
* Added other APIs to automatically generate protocols, such as
'protocolForURI()', 'sequenceOf()', and 'Variation()'.
* Compatible with Zope X3 Milestone 4, Python 2.3.2, and Twisted
1.1.0. (Also runs on Python 2.2.2+, if you don't need Zope 3 compatibility.)
* New 'Adapter' and 'StickyAdapter' convenience base classes
* Fixes for compatibility with 'ExtensionClass', and for a memory leak in
the optional C "speedups" module
* Detailed Changes since the 0.9 release:
* Release notes, installation instructions, and browsable API docs:
* Source and Binary Releases:
* Reference Manual (HTML):
* Reference Manual (PDF):
* Browsable CVS Repository: