[Twisted-Python] R: Twisted Python on Nokia E71x (Running the phone Python Interpreter)

2010-03-05 Thread lorma...@libero.it
>Date: Thu, 4 Mar 2010 15:57:43 -0600
>From: Prince Riley 
>Subject: [Twisted-Python] Twisted Python on Nokia E71x (Running the
>   phone   Python Interpreter)
>To: twisted-python@twistedmatrix.com
>Message-ID:
>   
>Content-Type: text/plain; charset="iso-8859-1"
>
>Has anyone experimented with twisted-python on the Nokia E71x or E72
>smartphones?
>
>Prince Riley

Hi,
I had tried to use Python for S60 (not Twisted, but standard socket module) 
writing a NNTP client, but I found many problem specially about networking. 
There is no high-layer abstraction layer for networking, so you have to 
implement all the logic from low level.
I tried to use select (that may be useful for doing asynchronous networking 
apps), but is not working correctly on s60 phones. There is no porting for 
Twisted.
My experience is that PyS60 is not mature for a production environment.


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] R: Twisted Python on Nokia E71x (Running the phone Python Interpreter)

2010-03-05 Thread Werner Thie

Hi

I mostly diddled with the cam and automated uploading of pictures with 
simple JSON encoding over WLAN, and as I said, twisted is running with a 
few patches on the E61i..


Using putools

http://people.csail.mit.edu/kapu/symbian/python.html

helped a lot.

Please find attached a tiny example with a very primitive server and a 
client counterpart using the standard socket API in python on the E61i. 
Although the pictures are lousy (the cam looses the white balance when 
the picture is taken) this code ran for days with no problem. So 'not 
ready for production' seems to me a bit too harsh as a judgment.


Werner

lorma...@libero.it wrote:

Date: Thu, 4 Mar 2010 15:57:43 -0600
From: Prince Riley 
Subject: [Twisted-Python] Twisted Python on Nokia E71x (Running the
phone   Python Interpreter)
To: twisted-python@twistedmatrix.com
Message-ID:

Content-Type: text/plain; charset="iso-8859-1"

Has anyone experimented with twisted-python on the Nokia E71x or E72
smartphones?

Prince Riley


Hi,
I had tried to use Python for S60 (not Twisted, but standard socket module) 
writing a NNTP client, but I found many problem specially about networking. 
There is no high-layer abstraction layer for networking, so you have to 
implement all the logic from low level.
I tried to use select (that may be useful for doing asynchronous networking 
apps), but is not working correctly on s60 phones. There is no porting for 
Twisted.

My experience is that PyS60 is not mature for a production environment.


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


jsonphotoclient.py
Description: application/python


photoserver.py
Description: application/python
# jasstest.tac - controlling file for a single instance jass webapp
# -*- coding: iso-8859-1 -*-
#
# author   : Werner Thie, wth
# last edit: 20.03.2009
# modhistory:
#   20.03.2009 - wth, created

import sys, os

path = os.getcwd()
sys.path.append(path)

from twisted.python import log
from twisted.python.log import ILogObserver, FileLogObserver
from twisted.python.logfile import LogFile

from twisted.internet import reactor

from twisted.application import service, strports, internet

from photoserver import gRSRC, JSONFactory

application = service.Application("photoserver")
application.setComponent(ILogObserver, 
FileLogObserver(LogFile('photoserver.log', '/var/log', 
rotateLength=1000)).emit)

gRSRC = JSONFactory()
#site = server.Site(gRSRC)
webserver = strports.service("tcp:9000", gRSRC)
webserver.setServiceParent(application)

#this main() is only used for debugging the server, this file should be run 
with twistd
def main():
  log.startLogging(sys.stdout)
  reactor.listenTCP(9000, gRSRC)   #start only a basic service when 
debugging
  reactor.run()

if __name__ == '__main__':
  main()
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 9.0.0?

2010-03-05 Thread Mark van Lent
On 3/4/10 21:21 , exar...@twistedmatrix.com wrote:
>> I think that easy_install and related tools can be directed to the
>> proper download location by providing a Download-URL on the PyPI page.
>>
>> E.g. the page for Twisted 9.0.0:
>> http://pypi.python.org/pypi/Twisted/9.0.0
>>
>> should have a Download-URL link to:
>> http://tmrc.mit.edu/mirror/twisted/Twisted/9.0/
>
> That's easy enough to adjust.  There.  Someone want to try it and see if
> it works?

Thanks Jean-Paul and Ziga! It indeed works like a charm!

I have to admit that, for someone who uses PyPi daily, I know too little 
about it. I probably would have started tinkering with my zc.buildout 
configuration to get it working, but this is a much better solution.

Thanks again,
Mark


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 9.0.0?

2010-03-05 Thread Chris Withers
Tim Allen wrote:
> On Thu, Mar 04, 2010 at 01:55:50PM -0500, Glyph Lefkowitz wrote:
>> Now that our release process is better documented (THANK YOU JML), you
>> might be able to have a look at
>>  and figure out
>> where 'setup.py upload' could fit in without uploading a tarball that
>> is _not_ actually our official release.
> 
> If "setup.py upload" involves "setup.py sdist" then I guess this is
> ticket #4138 again.

No, it doesn't... see the release process I use for my own packages here:

http://packages.python.org/errorhandler/development.html#making-a-release

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 9.0.0?

2010-03-05 Thread Tim Allen
On Fri, Mar 05, 2010 at 11:11:35AM +, Chris Withers wrote:
> Tim Allen wrote:
> > If "setup.py upload" involves "setup.py sdist" then I guess this is
> > ticket #4138 again.
> 
> No, it doesn't... see the release process I use for my own packages here:
> 
> http://packages.python.org/errorhandler/development.html#making-a-release

Hmm... at the bottom of that page, I see you run (among other things):

setup.py sdist upload

...so presumably sdist *is* a prerequisite for upload. Or are you saying
that you can store any old file as dist/$PACKAGE-$VERSION.tar.gz and
"setup.py upload" will ship it to PyPI?

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 9.0.0?

2010-03-05 Thread Chris Withers
Tim Allen wrote:
> ...so presumably sdist *is* a prerequisite for upload. Or are you saying
> that you can store any old file as dist/$PACKAGE-$VERSION.tar.gz and
> "setup.py upload" will ship it to PyPI?

I think that's true, but I admit, I haven't checked myself ;-)

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
 - http://www.simplistix.co.uk

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted 9.0.0?

2010-03-05 Thread exarkun
On 02:42 pm, ch...@simplistix.co.uk wrote:
>Tim Allen wrote:
>>...so presumably sdist *is* a prerequisite for upload. Or are you 
>>saying
>>that you can store any old file as dist/$PACKAGE-$VERSION.tar.gz and
>>"setup.py upload" will ship it to PyPI?
>
>I think that's true, but I admit, I haven't checked myself ;-)

It is.  Or at least something like sdist.  The thread Glyph linked to 
covers this.

Jean-Paul

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Lore to Sphinx Conversion Progress Report 6

2010-03-05 Thread Drew Smathers
On Thu, Mar 4, 2010 at 5:49 PM, Kevin Horn  wrote:

>
> It's been a while, I know you were all waiting with baited breath...
>
> First a few fixes:
>
> - Thanks to Tim Allen and Steve Steiner, several theme issues were fixed.
> This
>   fixes a few minor display bugs and should make pages validate properly.
>
> - inline markup will now include child contents.  This causes rst not to
> display
>   properly in cases of "nested inline markup", but should make it easier to
>
>   manually fix these places later
>
> - :download: links are now generated for non-rst files ending in .py (most
> of the
>   examples), as welll as .tac and .sql files
>
> - toc entries which end in a "/" character now have "index appended to them
>   in the ReST output, which fixes a few issues where the built-Sphinx docs
>   would end up with broken navigation links.
>
> A couple of issues were also fixed at the PyCon sprints:
>
> -  tags are now handled...sort of.  According to Glyph, these aren't
> really
>   very important, so we just return the contents of the tag without any
> special
>   markup.  If we feel the need to put citation markup back into the docs we
> can
>   do that post-transition.
>
> - Glyph also found an easy way to improve the CSS of the theme somewhat.
> The
>   issue where the sidebar drops below the main content should now be less
> of a
>   problem, though it's not gone entirely.
>
> - Glyph and I also discussed a few different ways to handle links to the
> API docs
>   and agreed on a way forward.  Basically, well change the  class='API'>
>   tags into something like: :api:`path.to.documented object `, and
> then
>   create a docutils extension to convert that into a link.  The beginnings
> of this
>   are in the hg repos, but it looks like it won't be quite as simple as we
> thought.
>
>   First, the way pydoctor generates links is deceptively simple.
>
>   If you look up a module, like "twisted.internet.defer", the link looks
> like
>   this:
>
>
> http://twistedmatrix.com/documents/9.0.0/api/twisted.internet.defer.html
>
>   If you look up a class, like "twisted.internet.defer.Deferred" for
> example,
>   the link looks like this:
>
>
> http://twistedmatrix.com/documents/current/api/twisted.internet.defer.Deferred.html
>
>   Pretty simple right?  But if you look up a function or method like
>   "twisted.internet.defer.Deferred.callback", the link has an anchor, like
> so:
>
>
> http://twistedmatrix.com/documents/9.0.0/api/twisted.internet.defer.Deferred.html#addCallback
>
>   So we'll need to do some checking on either the api docs or on twisted
> itself
>   to determine what sort of object is being linked to.  Shouldn't be
>   super-difficult, just haven't had time yet.
>
>   Second, I haven't yet figured out how to access the Sphinx config object
> from
>   a docutils role function.  I'm sure this is just a matter of finding an
> example
>   or getting an answer from the mailing list, but I just haven't gotten to
> it yet.
>
> I think the API links are the only major issue still remaining until we
> start doing
> the conversion, so once this issue is handled, I'll probably file a ticket
> and create
> a branch in SVN for the conversion.
>
> If anyone has any docs tickets open, now is the time to get them fixed!
>
>
>
How can I filter for tickets related to lore2sphinx transition in trac?
 I've noticed a few documents that don't seem properly converted. Here's an
example:

http://twistedsphinx.funsize.net/projects/web/howto/web-in-60/asynchronous.html

... which is missing syntax highlighting on code examples and the code
examples are also truncated.

-Drew
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] SSHSessionProcessProtocol.inConnectionLost() behavior and Git over Conch

2010-03-05 Thread Bo Shi
Thanks Michael; I have filed #4350.

On Thu, Mar 4, 2010 at 11:51 PM, Michael Hudson-Doyle  wrote:
> On 4 March 2010 17:46, Bo Shi  wrote:
>> Hi All,
>>
>> I've been struggling with this issue off and on for the better part of
>> a month now.  Having implemented a simple git SSH server using some of
>> the Conch examples in the official documentation, I encountered an
>> issue that would cause a git client to throw an error only part of the
>> time.
>
> I think it's a bug in conch.
>
>> The little program to reproduce the issue is found at
>>
>>    http://gist.github.com/321403
>>
>>    (raw version for download)
>>    
>> http://gist.github.com/raw/321403/82ab2111a2709c8fe50a77aabb08565749087408/gitconnbug.py
>>
>> and can be executed to start the sample server.  Run a command like
>>
>>    # The /abspath/to/git/repo should be readable by the server user
>>    $ git clone ssh://u...@localhost:/abspath/to/git/repo
>>    (password "user")
>>
>> To test the server.  On my workstation, I am able to reproduce the
>> error at least once every 5 tries.  It's definitely not consistent.
>> The behavior I see is attached at the end of this email.  The client
>> fails due to a premature inConnectionLost() call in the
>> SSHSessionProcessProtocol that sends an EOF.
>>
>> As a workaround, when TraceProcessProtocol.inConnectionLost() is
>> overriden to do nothing, the client error goes away.  This is somewhat
>> foreign territory for me so I'm not sure whether it's a bug in git or
>> whether it's a bug in the twisted ProcessProtocol implementation.  RFC
>> 4254 isn't terribly helpful here:
>>
>>    5.3.  Closing a Channel
>>
>>       When a party will no longer send more data to a channel, it SHOULD
>>       send SSH_MSG_CHANNEL_EOF.
>>
>> So on the surface the current behavior of sending an EOF appears fine,
>> however, I can't really find any definitive cases of this type of
>> problem popping up via, say, default OpenSSH/git combinations.
>>
>>
>> Any advice?  Is the gitconnbug.py implementation flawed?  Should I
>> open a ticket?  Any git experts know of a case where git-upload-pack
>> might close it's stdout pipe?
>
> I think what's actually happening here is that git-upload-pack is
> closing its *stdin*.  Why conch reacts to that by shutting down the
> channel, I don't really know -- it doesn't seem right to me.  Maybe
> it's a simple logic error and it method should be
> 'outConnectionClosed' instead?
>
> At any rate, I think this is a bug -- please file a ticket.  And
> thanks for the complete example!
>
> Cheers,
> mwh
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



-- 
Bo Shi
617-942-1744

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] SSHSessionProcessProtocol.inConnectionLost() behavior and Git over Conch

2010-03-05 Thread James Y Knight

On Mar 4, 2010, at 11:51 PM, Michael Hudson-Doyle wrote:

> Maybe
> it's a simple logic error and it method should be
> 'outConnectionClosed' instead?

I'd agree with that. Clearly it should not be sending EOF there for  
the server process closing its stdin. One more detail though: you  
actually need to wait for both stdout and stderr to close, not just  
stdout.

[[[Sidenote:
There *is* no standard SSH protocol message for closing your stdin.
But if openssh 5.1 or later connects to an openssh 5.1 or later  
server, it will use the nonstandard e...@openssh.org command to  
indicate a closed stdin.

Thus, on standard ssh servers/clients, the command:
   ssh hostname yes | true
will hang forever. True closed its stdin by virtue of exiting, but  
that can't get propagated across the ssh link. So, yes never gets a  
SIGPIPE, and thus never closes its stdout and the command keeps  
running forever.

But on openssh 5.1 or greater on both ends, it will "work properly".

BTW, you can't reasonably implement this extension in conch even if  
you wanted to, because openssh client will only send it to servers  
which identify themselves as openssh servers.

http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL
]]]

James

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Escaping variable names

2010-03-05 Thread Kamil Wasilewski
Hi,

Ive got an issue where a variable name needs to have a minus sign (-) in it.

from SOAPpy import WSDL
wsdlFile = "http://webapi.allegro.pl/uploader.php?wsdl";
server = WSDL.Proxy(wsdlFile)
server.soapproxy.config.argsOrdering = {'doGetCountries': ['country-code',
'webapi-key'] }
server.doGetCountries(country-code=COUNTRYID}, webapi-key=WEBAPIKEY)

The above method allows me to specify the order and name of variables being
sent, but i have a problem since the variables have a "-" sign in the
middle, is there a way to escape it in the variable name or get around the
problem?

Thanks!
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] SSHSessionProcessProtocol.inConnectionLost() behavior and Git over Conch

2010-03-05 Thread Glyph Lefkowitz

On Mar 5, 2010, at 12:07 PM, James Y Knight wrote:

> BTW, you can't reasonably implement this extension in conch even if  
> you wanted to, because openssh client will only send it to servers  
> which identify themselves as openssh servers.

Does it just test the banner for being identical, or could we have Conch 
identify itself as OpenSSH, version (5.1.something+Conch-Not-OpenSSH)?



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Escaping variable names

2010-03-05 Thread Phil Christensen
On Mar 5, 2010, at 12:15 PM, Kamil Wasilewski wrote:
> server.soapproxy.config.argsOrdering = {'doGetCountries': ['country-code', 
> 'webapi-key'] }
> server.doGetCountries(country-code=COUNTRYID}, webapi-key=WEBAPIKEY)
> 
> The above method allows me to specify the order and name of variables being 
> sent, but i have a problem since the variables have a "-" sign in the middle, 
> is there a way to escape it in the variable name or get around the problem?
> 
> Thanks!

try:

server.doGetCountries(**{'country-code':COUNTRYID, 'webapi-key':WEBAPIKEY})

-phil
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Escaping variable names

2010-03-05 Thread Maarten ter Huurne
On Friday 05 March 2010, Kamil Wasilewski wrote:

> from SOAPpy import WSDL
> wsdlFile = "http://webapi.allegro.pl/uploader.php?wsdl";
> server = WSDL.Proxy(wsdlFile)
> server.soapproxy.config.argsOrdering = {'doGetCountries':
> ['country-code', 'webapi-key'] }
> server.doGetCountries(country-code=COUNTRYID}, webapi-key=WEBAPIKEY)
> 
> The above method allows me to specify the order and name of variables
> being sent, but i have a problem since the variables have a "-" sign in
> the middle, is there a way to escape it in the variable name or get
> around the problem?

Yes, you can pass them from a dictionary using the ** syntax:

server.doGetCountries(**{
'country-code': COUNTRYID, 'webapi-key': WEBAPIKEY
})

However, if you have the ability to change the API, it would be better to 
use underscores as separators in the argument names instead of dashes.

Bye,
Maarten

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Lore to Sphinx Conversion Progress Report 6

2010-03-05 Thread Kevin Horn
On Fri, Mar 5, 2010 at 9:30 AM, Drew Smathers wrote:

> On Thu, Mar 4, 2010 at 5:49 PM, Kevin Horn  wrote:
>
>>
>> It's been a while, I know you were all waiting with baited breath...
>>
>> First a few fixes:
>>
>> - Thanks to Tim Allen and Steve Steiner, several theme issues were fixed.
>> This
>>   fixes a few minor display bugs and should make pages validate properly.
>>
>> - inline markup will now include child contents.  This causes rst not to
>> display
>>   properly in cases of "nested inline markup", but should make it easier
>> to
>>   manually fix these places later
>>
>> - :download: links are now generated for non-rst files ending in .py (most
>> of the
>>   examples), as welll as .tac and .sql files
>>
>> - toc entries which end in a "/" character now have "index appended to
>> them
>>   in the ReST output, which fixes a few issues where the built-Sphinx docs
>>   would end up with broken navigation links.
>>
>> A couple of issues were also fixed at the PyCon sprints:
>>
>> -  tags are now handled...sort of.  According to Glyph, these aren't
>> really
>>   very important, so we just return the contents of the tag without any
>> special
>>   markup.  If we feel the need to put citation markup back into the docs
>> we can
>>   do that post-transition.
>>
>> - Glyph also found an easy way to improve the CSS of the theme somewhat.
>> The
>>   issue where the sidebar drops below the main content should now be less
>> of a
>>   problem, though it's not gone entirely.
>>
>> - Glyph and I also discussed a few different ways to handle links to the
>> API docs
>>   and agreed on a way forward.  Basically, well change the > class='API'>
>>   tags into something like: :api:`path.to.documented object `, and
>> then
>>   create a docutils extension to convert that into a link.  The beginnings
>> of this
>>   are in the hg repos, but it looks like it won't be quite as simple as we
>> thought.
>>
>>   First, the way pydoctor generates links is deceptively simple.
>>
>>   If you look up a module, like "twisted.internet.defer", the link looks
>> like
>>   this:
>>
>>
>> http://twistedmatrix.com/documents/9.0.0/api/twisted.internet.defer.html
>>
>>   If you look up a class, like "twisted.internet.defer.Deferred" for
>> example,
>>   the link looks like this:
>>
>>
>> http://twistedmatrix.com/documents/current/api/twisted.internet.defer.Deferred.html
>>
>>   Pretty simple right?  But if you look up a function or method like
>>   "twisted.internet.defer.Deferred.callback", the link has an anchor, like
>> so:
>>
>>
>> http://twistedmatrix.com/documents/9.0.0/api/twisted.internet.defer.Deferred.html#addCallback
>>
>>   So we'll need to do some checking on either the api docs or on twisted
>> itself
>>   to determine what sort of object is being linked to.  Shouldn't be
>>   super-difficult, just haven't had time yet.
>>
>>   Second, I haven't yet figured out how to access the Sphinx config object
>> from
>>   a docutils role function.  I'm sure this is just a matter of finding an
>> example
>>   or getting an answer from the mailing list, but I just haven't gotten to
>> it yet.
>>
>> I think the API links are the only major issue still remaining until we
>> start doing
>> the conversion, so once this issue is handled, I'll probably file a ticket
>> and create
>> a branch in SVN for the conversion.
>>
>> If anyone has any docs tickets open, now is the time to get them fixed!
>>
>>
>>
> How can I filter for tickets related to lore2sphinx transition in trac?
>  I've noticed a few documents that don't seem properly converted. Here's an
> example:
>
>
> http://twistedsphinx.funsize.net/projects/web/howto/web-in-60/asynchronous.html
>
> ... which is missing syntax highlighting on code examples and the code
> examples are also truncated.
>
> -Drew
>
>
As far as I know, there aren't any tickets in Trac yet.  I was planning on
making some (or asking others to do so) once a "master ticket" and a branch
are created.

As for the specific issue you linked to, the ReST markup is similar to that
on other pages, but it looks like Sphinx isn't recognizing the code samples
as Python for some reason.  I'll look into this later on.

Kevin Horn
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Escaping variable names

2010-03-05 Thread Kamil Wasilewski
Hello Maarten,

Friday, March 5, 2010, 6:26:36 PM, you wrote:

> On Friday 05 March 2010, Kamil Wasilewski wrote:

>> from SOAPpy import WSDL
>> wsdlFile = "http://webapi.allegro.pl/uploader.php?wsdl";
>> server = WSDL.Proxy(wsdlFile)
>> server.soapproxy.config.argsOrdering = {'doGetCountries':
>> ['country-code', 'webapi-key'] }
>> server.doGetCountries(country-code=COUNTRYID}, webapi-key=WEBAPIKEY)
>> 
>> The above method allows me to specify the order and name of variables
>> being sent, but i have a problem since the variables have a "-" sign in
>> the middle, is there a way to escape it in the variable name or get
>> around the problem?

> Yes, you can pass them from a dictionary using the ** syntax:

> server.doGetCountries(**{
> 'country-code': COUNTRYID, 'webapi-key': WEBAPIKEY
> })

  The above gives a syntax error...

> However, if you have the ability to change the API, it would be better to
> use underscores as separators in the argument names instead of dashes.

  Unfortunately the designer of the API is a large British company that
  forgot to take into account other languages than PHP.


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Escaping variable names

2010-03-05 Thread Maarten ter Huurne
On Friday 05 March 2010, Kamil Wasilewski wrote:
> > server.doGetCountries(**{
> > 'country-code': COUNTRYID, 'webapi-key': WEBAPIKEY
> > })
> 
>   The above gives a syntax error...

What kind of syntax error? I tested this approached on the interactive 
Python shell and it worked fine there:

>>> def f(**kvargs):
...   print kvargs
... 
>>> f(a = 1, **{'b-c': 12})
{'a': 1, 'b-c': 12}

Bye,
Maarten

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Escaping variable names

2010-03-05 Thread Kamil Wasilewski

> On Friday 05 March 2010, Kamil Wasilewski wrote:
>> > server.doGetCountries(**{
>> > 'country-code': COUNTRYID, 'webapi-key': WEBAPIKEY
>> > })
>> 
>>   The above gives a syntax error...

> What kind of syntax error? I tested this approached on the interactive
> Python shell and it worked fine there:

 def f(**kvargs):
> ...   print kvargs
> ... 
 f(a = 1, **{'b-c': 12})
> {'a': 1, 'b-c': 12}


hu, it did work.. must of been a mistake on my part.
But i tried that method a few times.
Well that solved a problem ive been sitting on for a while. Thank you!


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] R: Twisted Python on Nokia E71x (Running the phone Python Interpreter)

2010-03-05 Thread Laurens Van Houtven
I don't use PUTools when developing for PyS60. The bluetooth console
was nice, but recent versions of PyS60 ship with it already. My phone
(6220 Classic) lets me do obex + bluetooth serial console at the same
time so file sync is not a problem either.


hth
lvh

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python