Issue 14 in salesforce-beatbox: AttributeError: BeatBoxXmlGenerator instance has no attribute '_out'

182 görüntüleme
İlk okunmamış mesaja atla

codesite...@google.com

okunmadı,
4 May 2013 01:11:564.05.2013
alıcı plo...@googlegroups.com
Status: New
Owner: ----

New issue 14 by daniel...@gmail.com: AttributeError: BeatBoxXmlGenerator
instance has no attribute '_out'
http://code.google.com/p/salesforce-beatbox/issues/detail?id=14

What steps will reproduce the problem?
1. Deploy Ubuntu 13.04.
2. Deploy and import the beatbox library.
3. Attempt to login.
4. Observe error.

What is the expected output?
I expect to see a the login method for the client return a valid dictionary.

What do you see instead?
An error. Something similar to the following...

File "./script", line 52, in <module>
svc.login('us...@salesforce.com', 'password123' + 'tokentokentoken')
File "/any/given/path/beatbox/python_client.py", line 73, in login
res = BaseClient.login(self, username, passwd)
File "/any/given/path/beatbox/_beatbox.py", line 60, in login
lr = LoginRequest(self.serverUrl, username, password).post()
File "/any/given/path/beatbox/_beatbox.py", line 309, in post
conn.request("POST", path, self.makeEnvelope(), headers)
File "/any/given/path/beatbox/_beatbox.py", line 266, in makeEnvelope
s = SoapWriter()
File "/any/given/path/beatbox/_beatbox.py", line 243, in __init__
self.startElement(_envNs, "Envelope")
File "/any/given/path/beatbox/_beatbox.py", line 177, in startElement
self.xg.startElementNS((namespace, name), name, attrs)
File "/any/given/path/beatbox/_beatbox.py", line 146, in startElementNS
self._out.write('<' + self.makeName(name))
AttributeError: BeatBoxXmlGenerator instance has no attribute '_out'


What version of the product are you using?
beatbox v20.

On what operating system?
Ubuntu 13.04

Please provide any additional information below.
It looks like on Sun, 10 Feb 2013 14:29:52 +0200 (2 months ago), Serhiy
Storchaka <stor...@gmail.com> removed the reference to the _out property
of the XMLGenerator class. Here is there reference:
http://hg.python.org/cpython/diff/66f92f76b2ce/Lib/xml/sax/saxutils.py#l1.71


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

codesite...@google.com

okunmadı,
4 May 2013 01:27:174.05.2013
alıcı plo...@googlegroups.com

Comment #1 on issue 14 by daniel...@gmail.com: AttributeError:
BeatBoxXmlGenerator instance has no attribute '_out'
http://code.google.com/p/salesforce-beatbox/issues/detail?id=14

This patch allows it to work. Had to import hashlib for the unicode bits...

$ diff -u _beatbox.py.original _beatbox.py
--- _beatbox.py.original 2013-05-04 01:16:01.628273167 -0400
+++ _beatbox.py 2013-05-04 01:24:20.184252201 -0400
@@ -6,6 +6,7 @@
__copyright__ = "(C) 2006 Simon Fell. GNU GPL 2."

import httplib
+import hashlib
import logging
import socket
from urlparse import urlparse
@@ -143,15 +144,15 @@
return self._current_context[name[0]] + ":" + name[1]

def startElementNS(self, name, qname, attrs):
- self._out.write('<' + self.makeName(name))
+ self._write(unicode('<' + self.makeName(name)))

for pair in self._undeclared_ns_maps:
- self._out.write(' xmlns:%s="%s"' % pair)
+ self._write(unicode(' xmlns:%s="%s"' % pair))
self._undeclared_ns_maps = []

for (name, value) in attrs.items():
- self._out.write(' %s=%s' % (self.makeName(name),
quoteattr(value)))
- self._out.write('>')
+ self._write(unicode(' %s=%s' % (self.makeName(name),
quoteattr(value))))
+ self._write(unicode('>'))

# general purpose xml writer, does a bunch of useful stuff above & beyond
XmlGenerator
class XmlWriter:

codesite...@google.com

okunmadı,
16 May 2013 15:21:0916.05.2013
alıcı plo...@googlegroups.com

Comment #2 on issue 14 by ethan.gl...@gmail.com: AttributeError:
BeatBoxXmlGenerator instance has no attribute '_out'
http://code.google.com/p/salesforce-beatbox/issues/detail?id=14

Why is hashlib necessary here?

codesite...@google.com

okunmadı,
18 Tem 2013 22:26:2318.07.2013
alıcı plo...@googlegroups.com

Comment #3 on issue 14 by richwkl...@gmail.com: AttributeError:
BeatBoxXmlGenerator instance has no attribute '_out'
http://code.google.com/p/salesforce-beatbox/issues/detail?id=14

This problem just cropped up for us. Any idea what caused it to start
appearing some new version of python?

codesite...@google.com

okunmadı,
23 Oca 2014 16:01:3023.01.2014
alıcı plo...@googlegroups.com

Comment #4 on issue 14 by andy.che...@gmail.com: AttributeError:
BeatBoxXmlGenerator instance has no attribute '_out'
http://code.google.com/p/salesforce-beatbox/issues/detail?id=14

hashlib is not necessary. Otherwise - patch fixes it for me.

Any chance to get it merged?

codesite...@google.com

okunmadı,
3 Haz 2014 11:15:383.06.2014
alıcı plo...@googlegroups.com

Comment #5 on issue 14 by st...@mcsmith.org: AttributeError:
BeatBoxXmlGenerator instance has no attribute '_out'
http://code.google.com/p/salesforce-beatbox/issues/detail?id=14

> Any idea what caused it to start appearing some new version of python?

_out was an internal variable of XMLGenerator, and the internal
implementation changed. A reminder that _* variables should be regarded as
implementation-specific.

A slightly simpler and more robust fix:

Line 137:

+ self._out = destination
Tümünü yanıtla
Yazarı yanıtla
Yönlendir
0 yeni ileti