mirror of
https://github.com/mightyBroccoli/xmpp-chatbot.git
synced 2024-12-04 22:33:36 +01:00
NoneType Bug fix
* fixed NoneType tag bug
This commit is contained in:
parent
de56a9315c
commit
d1b8090ee8
1 changed files with 12 additions and 12 deletions
|
@ -66,7 +66,7 @@ class XEPRequest:
|
||||||
"""
|
"""
|
||||||
# all possible subtags grouped by location
|
# all possible subtags grouped by location
|
||||||
last_revision_tags = ["date", "version", "initials", "remark"]
|
last_revision_tags = ["date", "version", "initials", "remark"]
|
||||||
xep_tags = ["number", "title", "abstract", "type", "status", "approver", "shortname", "sig", "lastcall"]
|
xep_tags = ["number", "title", "abstract", "type", "status", "approver", "shortname", "sig", "lastcall", "date", "version", "initials", "remark"]
|
||||||
|
|
||||||
# check if xeplist is accurate
|
# check if xeplist is accurate
|
||||||
self.req_xeplist()
|
self.req_xeplist()
|
||||||
|
@ -75,16 +75,22 @@ class XEPRequest:
|
||||||
# if requested number is member of acceptedxeps continue
|
# if requested number is member of acceptedxeps continue
|
||||||
if str(self.reqxep) in self.acceptedxeps:
|
if str(self.reqxep) in self.acceptedxeps:
|
||||||
searchstring = ".//*[@accepted='true']/[number='%s']" % self.reqxep
|
searchstring = ".//*[@accepted='true']/[number='%s']" % self.reqxep
|
||||||
query = None
|
|
||||||
|
|
||||||
for item in self.xeplist.findall(searchstring):
|
for item in self.xeplist.findall(searchstring):
|
||||||
# if the opt_arg references is member of xeptag return only that tag
|
# if the opt_arg references is member of xeptag return only that tag
|
||||||
if self.opt_arg in xep_tags:
|
if self.opt_arg in xep_tags:
|
||||||
query = item.find(self.opt_arg)
|
|
||||||
|
|
||||||
# if the opt_arg references is member of last-revision_tags return only that tag
|
# if the opt_arg references is member of last_revision_tags return only that subtag
|
||||||
elif self.opt_arg in last_revision_tags:
|
if self.opt_arg in last_revision_tags:
|
||||||
query = item.find("last-revision").find(self.opt_arg)
|
query = item.find("last-revision").find(self.opt_arg)
|
||||||
|
else:
|
||||||
|
query = item.find(self.opt_arg)
|
||||||
|
|
||||||
|
# append opt_arg results to the result list
|
||||||
|
if query is not None:
|
||||||
|
result.append("%s : %s" % (query.tag, query.text))
|
||||||
|
else:
|
||||||
|
result.append("%s does not have a %s tag." % (self.reqxep, self.opt_arg))
|
||||||
|
|
||||||
# in any other case return the general answer
|
# in any other case return the general answer
|
||||||
else:
|
else:
|
||||||
|
@ -92,12 +98,6 @@ class XEPRequest:
|
||||||
for tag in result_opts:
|
for tag in result_opts:
|
||||||
result.append(item.find(tag).text)
|
result.append(item.find(tag).text)
|
||||||
|
|
||||||
# append opt_arg results to the result list
|
|
||||||
if query is not None:
|
|
||||||
result.append("%s : %s" % (query.tag, query.text))
|
|
||||||
else:
|
|
||||||
result.append("%s does not have a %s tag." % (self.reqxep, self.opt_arg))
|
|
||||||
|
|
||||||
# if the requested number is no member of acceptedxeps and/or not accepted return error.
|
# if the requested number is no member of acceptedxeps and/or not accepted return error.
|
||||||
else:
|
else:
|
||||||
result.append("XEP-%s : is not available." % self.reqxep)
|
result.append("XEP-%s : is not available." % self.reqxep)
|
||||||
|
|
Loading…
Reference in a new issue