<br>hhggztzuiuiuojjnhfgttrtuuzggzgdlsssdswrdrfrtgh<br><br><br>.+-+;/;+-*52gjz<br>Send Twisted-Python mailing list submissions to
<br>        twisted-python@twistedmatrix.com
<br>
<br>To subscribe or unsubscribe via the World Wide Web, visit
<br>        http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
<br>or, via email, send a message with subject or body 'help' to
<br>        twisted-python-request@twistedmatrix.com
<br>
<br>You can reach the person managing the list at
<br>        twisted-python-owner@twistedmatrix.com
<br>
<br>When replying, please edit your Subject line so it is more specific
<br>than "Re: Contents of Twisted-Python digest..."
<br>
<br>
<br>Today's Topics:
<br>
<br>   1. Re: regarding classes and functions in        twisted.python.reflect
<br>      (Glyph)
<br>   2. Re: ConnectionMixin.loseConnection (in _newtls)        lacking
<br>      arguments (Glyph)
<br>   3. Re: Unknown constants (Glyph)
<br>
<br>
<br>----------------------------------------------------------------------
<br>
<br>Message: 1
<br>Date: Thu, 29 Dec 2011 18:14:09 -0500
<br>From: Glyph <glyph@twistedmatrix.com>
<br>Subject: Re: [Twisted-Python] regarding classes and functions in
<br>        twisted.python.reflect
<br>To: Twisted general discussion <twisted-python@twistedmatrix.com>
<br>Message-ID: <800C83A7-B558-4E5B-AB0F-393AB81411AA@twistedmatrix.com>
<br>Content-Type: text/plain; charset=us-ascii
<br>
<br>
<br>On Dec 29, 2011, at 10:52 AM, L. Daniel Burr wrote:
<br>
<br>> Hi moijes12,
<br>> 
<br>> 
<br>> On Thu, 29 Dec 2011 06:30:04 -0600, moses dsouza <moijes12@gmail.com>  
<br>> wrote:
<br>> 
<br>>> Hi
<br>>> 
<br>>> I'm new to twisted. While was working on bug #5385 I noticed that classes
<br>>> AccessorType, PropertyAccessor, Accessor and Summer were rarely used
<br>>> elsewhere in the code. Similaryly many functions exists which are unused.
<br>>> Do we need these functions and classes? I do understand that the purpose
<br>>> t.python.reflect provides  "Standardized versions of various cool and/or
<br>>> strange things that you can do with Python's reflection capabilities."   
<br>>> but
<br>>> I feel if we could remove things that we don't need we could make the  
<br>>> code
<br>>> base smaller and move towards making twisted more efficient.
<br>>> 
<br>> 
<br>> How would removing this code make twisted more efficient?  Is the savings  
<br>> in disk-space significant?  Also, just because there is code in  
<br>> t.p.reflect that is not used within twisted itself does not mean that  
<br>> applications written using twisted are not using that code.
<br>> 
<br>> I think, in general, everyone likes the notion of making a codebase  
<br>> smaller, but you always have to measure the benefit and the risk of doing  
<br>> so.
<br>> 
<br>> Have a good one,
<br>> 
<br>> L. Daniel Burr
<br>
<br>Hi Moses,
<br>
<br>I pretty much agree with everything Daniel said, but I want to make sure you take it at face value, and not as Twisted's excuse for never removing anything :).  If it's truly a bad idea to use these APIs in new code - for example, if there's a Python feature that does what they do better, available in all the versions of Python we support - then they should definitely be removed.  You should file 2 tickets: one for deprecation, and one for removal, according to <http://twistedmatrix.com/trac/wiki/CompatibilityPolicy>.  If there are no objections on the ticket, we can close the deprecation one now and the removal one in the next release.
<br>
<br>Thanks,
<br>
<br>-glyph
<br>
<br>
<br>------------------------------
<br>
<br>Message: 2
<br>Date: Thu, 29 Dec 2011 18:19:42 -0500
<br>From: Glyph <glyph@twistedmatrix.com>
<br>Subject: Re: [Twisted-Python] ConnectionMixin.loseConnection (in
<br>        _newtls)        lacking arguments
<br>To: Twisted general discussion <twisted-python@twistedmatrix.com>
<br>Message-ID: <658BF4CE-9FB4-4C7C-A48C-E409AF953721@twistedmatrix.com>
<br>Content-Type: text/plain; charset=iso-8859-1
<br>
<br>
<br>On Dec 27, 2011, at 7:01 AM, Sa?l Ibarra Corretg? wrote:
<br>
<br>> Hi all,
<br>> 
<br>> I'm experiencing a TypeError exception in my code since I updated to
<br>> Twisted 11.1. After hunting it it seems to be caused because the
<br>> loseConnection function from (_newtls) lacks arguments.
<br>> 
<br>> If there is no OpenSSL support present in the system the
<br>> loseConnection function will be called in abstract.FileDescriptor
<br>> (please, correct me if I'm wrong), and the signature for
<br>> loseConnection is the following:
<br>> 
<br>> def loseConnection(self, _connDone=failure.Failure(main.CONNECTION_DONE)):
<br>> 
<br>> Shouldn't it be the same for _newtls.ConnectionMixin ? Or perhaps it
<br>> should accept *args and **kw and pass them on? Or am I wrong here?
<br>> 
<br>> 
<br>> Thanks and regards,
<br>> 
<br>> -- 
<br>> /Sa?l
<br>> http://saghul.net | http://sipdoc.net
<br>
<br>Hi Sa?l,
<br>
<br>The _connDone argument there is an internal convenience for that implementation of loseConnection(); it is not part of the API.  ITransport specifies that loseConnection takes no arguments.  See here: <http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.ITransport.html#loseConnection>.  You should fix your code to never pass an argument to loseConnection, as other transport implementations may also lack this argument.  (As a bizarre accident, the IOCP reactor also has this argument in its transport implementation, but there's no reason that it necessarily should.)
<br>
<br>However, the fact that you thought otherwise is a bug in our documentation :).  Please feel free to file tickets (<http://twistedmatrix.com/trac/newticket>) describing how you got to the loseConnection that takes an argument and why you didn't realize that you should be looking at ITransport instead :).
<br>
<br>Thanks,
<br>
<br>-glyph
<br>
<br>
<br>
<br>
<br>------------------------------
<br>
<br>Message: 3
<br>Date: Thu, 29 Dec 2011 18:28:17 -0500
<br>From: Glyph <glyph@twistedmatrix.com>
<br>Subject: Re: [Twisted-Python] Unknown constants
<br>To: Twisted general discussion <twisted-python@twistedmatrix.com>
<br>Message-ID: <888D99D6-092B-47D4-BB26-2C59615665E5@twistedmatrix.com>
<br>Content-Type: text/plain; charset=us-ascii
<br>
<br>
<br>On Dec 26, 2011, at 12:21 PM, Ralph Meijer wrote:
<br>
<br>> Hi,
<br>> 
<br>> I've been looking into using twisted.python.constants for representing 
<br>> the status codes of the XMPP Multi-User Chat protocol [1]. I will have 
<br>> objects representing messages, of which one of the attributes is 
<br>> 'mucStatuses', a set of status codes. This works out great for the 
<br>> initial set of available status codes. The protocol is parsed, and the 
<br>> status codes are represented by the ValueConstant instances returned by 
<br>> lookupByValue.
<br>> 
<br>> However, not all of the possible codes can be known up-front, as the 
<br>> protocol allows for registering new ones without changing the 
<br>> specification itself. Eventually, applications will receive status codes 
<br>> that are not (yet?) part of the set of defined constants in the 
<br>> implementation, and application developers (that do know about new 
<br>> codes) will want to handle these.
<br>> 
<br>> A possible remedy to would be to register new status codes from the 
<br>> application itself. My first try of just adding a new attribute to the 
<br>> class fails because they are not 'realized' as the _enumerants are cached.
<br>> 
<br>> I can imagine this also goes for unknown HTTP methods and HTTP status 
<br>> codes, used as examples in the documentation. Any suggestions on how to 
<br>> handle such unknown constants?
<br>> 
<br>> 
<br>> [1] <http://xmpp.org/extensions/xep-0045.html#statuscodes>
<br>
<br>twisted.python.constants is a work in progress; there are many planned features that it doesn't have yet.  Perhaps you should simply add the feature that you want - the ability to adding new attributes to the class?
<br>
<br>-glyph
<br>
<br>
<br>
<br>
<br>------------------------------
<br>
<br>_______________________________________________
<br>Twisted-Python mailing list
<br>Twisted-Python@twistedmatrix.com
<br>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
<br>
<br>
<br>End of Twisted-Python Digest, Vol 93, Issue 27
<br>**********************************************
<br>