title: python class variable in static method
body: <p>[updated]: Full code</p>
  
  <p>I always get confused with pyhton's staticmethods
  but according to <a href="https://stackoverflow.com/questions/11233729/access-static-variable-from-static-method">this</a> (last answer), it should work!</p>
  
  <p>getting error: </p>
  
  <blockquote>
    <p>AttributeError: class MyConnection has no attribute 'myuser'</p>
  </blockquote>
  
  <pre><code>class MyConnection:
      def __init__(self, hostname, port, user, password):
          myhostname = hostname
          myport = port
          myuser = user
          mypassword = password
          isisessid = None
  
      @staticmethod
      def connect():
          my_session = MyConnection()
  
          headers = {'content-type': 'application/json'}
          headers['Authorization'] = 'Basic ' + string.strip(
              base64.encodestring(MyConnection.myuser + ':' + MyConnection.mypassword))
  
          body = json.dumps({'username': MyConnection.myuser, 'password': MyConnection.mypassword,
              'services': ['platform', 'namespace']})
  
          uri = '/session/1/session'
  
          connection = httplib.HTTPSConnection(MyConnection.myhostname, MyConnection.myport)
          connection.connect()
  
          try:
              connection.request('POST', uri, body, headers)
              response = connection.getresponse()
              my_session.isisessid = MyConnection.extract_session_id(
                  response.getheaders())
          except Exception, e:
              print e
              connection.close()
          except httplib.BadStatusLine, e:
              print e
              connection.close()
  
          return my_session
  </code></pre>