I am trying to construct a class and call upon some functions within that class, but nothing is returned, somehting should definitely be returned

#!/usr/bin/python
import cElementTree as ET
import urllib2
import MySQLdb
print "Content-type: text/html\n"
class xml:
    @staticmethod
    
    def find_text(element):
        if element.text:
            yield element
            for subelement in element:
                for txt in find_text(subelement):
                    yield txt

    def read_xml():
        # connect
        db = MySQLdb.connect(host = "localhost", user = "adamplo1", passwd = "U7RJM5HQ", db = "adamplo1_UniProject")

        # create a database cursor
        cursor = db.cursor(MySQLdb.cursors.DictCursor)

        # execute SQL select statement
        cursor.execute("SELECT * FROM Threshold")

        Results = cursor.fetchall()
        error = " "
        feed = urllib2.urlopen("http://server-up.theatticnetwork.net/demo/")
        try:
            tree = ET.parse(feed)
		
        except Exception, inst:
            print "Unexpected error opening %s: %s" % (tree, inst)
    
        root= tree.getroot()
        text = root.getchildren()

        for item in text:
            if item.tag =="Memory":
                extra = "Memory"
            elif item.tag == "Network":
                extra = "Network"
            elif item.tag == "Vitals":
                extra = "Vitals"
            elif item.tag == "Hardware":
                extra = "Hardware"
            elif item.tag == "Swap":
                extra = "Swap"
            elif item.tag == "Swapdevices":
                extra = "Swapdevices"
            elif item.tag == "FileSystem":
                extra = "FileSystem"
            else:    
                extra = "Other"
            for element in find_text(item):
                if extra+element.tag.replace(' ','') in Results[0].keys():
                    if element.text >= Results[0][extra+element.tag.replace(' ','')]:
                        error = error + "Error with "+item.tag+" "+element.tag+" value = "+element.text +" \n"
              
                else:
                    continue
        return error


a = xml()
problem = a.read_xml()
print problem

You return the string "error". It is an empty string unless the following is true.

for element in find_text(item):
    if extra+element.tag.replace(' ','') in Results[0].keys():
        if element.text >= Results[0][extra+element.tag.replace(' ','')]:
            error = error + "Error with "+item.tag+" "+element.tag+" value = "+element.text +" \n"
              
    else:
        continue

ok i have partially solved the problem and added static method bit above each function. But i am not getting the error message find_text is not defined.

How can i have class with two function in it. With on function calling on the other function within the class?

This question has already been answered. Start a new discussion instead.