def display(self, query, result): ## The dictionary is site wide and lives in the FlagDB dbh = DB.DBO() ## class_override the class variable: try: if len(query['class_override']) > 3: del query['class'] query['class'] = query['class_override'] del query['class_override'] except KeyError: pass status = '' ## Do we need to add a new entry: try: if len(query['word']) < 3: raise DB.DBError( "Word is too short to index, minimum of 3 letter words") if query['action'] == 'insert': try: if len(query['class']) < 3: raise DB.DBError( "Class name is too short, minimum of 3 letter words are used as class names" ) except KeyError: status = "Classification missing or too short" raise Indexing.insert_dictionary_word(query['word'], query['type'], query['class']) status = "Added word %s to dictionary" % query['word'] elif query['action'] == 'delete': dbh.delete("dictionary", where=DB.expand("word=%b and type=%r", (query['word'], query['type']))) status = "Deleted word %s from dictionary" % query['word'] except KeyError, e: pass