def get_xmlrpc_connection(): sessiondata = webinfo.environ['paste.session.factory']() conn = AthemeXMLConnection(XMLRPC_PATH, webinfo.environ['REMOTE_ADDR']) conn.username = sessiondata['conn.username'] conn.authcookie = sessiondata['conn.authcookie'] return conn
def process_login(self, nickname, password): webinfo.response.status = "302 Found" try: conn = AthemeXMLConnection(XMLRPC_PATH) conn.login(nickname, password) except: webinfo.response.headers['location'] = 'login' return '' webinfo.response.headers['location'] = 'session' sessiondata = webinfo.environ['paste.session.factory']() sessiondata['conn.username'] = conn.username sessiondata['conn.authcookie'] = conn.authcookie return ''
def process_registration(self, nickname, password, email): message = '' conn = AthemeXMLConnection(XMLRPC_PATH) message = conn.register(nickname, password, email) # try: # except: # webinfo.response.status = "302 Found" # webinfo.response.headers['location'] = 'register' # return '' webinfo.response.headers['location'] = 'account' return Template('regmessage').render(webinfo=webinfo, conn=conn, message=message)
from athemeweb.config import XMLRPC_PATH from athemeweb.athemeconnection import AthemeXMLConnection import code x = AthemeXMLConnection(XMLRPC_PATH) print "XMLRPC connection is declared as 'x'." code.InteractiveConsole({'x': x}).interact()