Exemplo n.º 1
0
import Log
from Person import Person
import XMLConnection

#People and Departments are held in the following lists for the duration of runtime
people = []
departments = []
serverVersion = "1.0py"
hits = 0
ahits = 0
dhits = 0
uhits = 0


#Fill the lists above from the XML Database
people = XMLConnection.getPeople()
departments = XMLConnection.getDepartments()

def addDept(dept):
    if XMLConnection.isDepartment(departments, dept):
        return 1
    else:
        departments.append(dept)
        XMLConnection.writeXML(departments, people)
        return 1
    return 0

#When using the QRY and AQRY command, this function is called, taking in a list of parts
#that are obtained by exploding the command string by the | character - requires 9 pipes
# - One for each piece of data for each Person - on failing to find a given field, the 
# search is stopped, and the next person is checked. Case no longer effects the results.