update

Fri, 08 May 2015 04:23:48 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Fri, 08 May 2015 04:23:48 +0300
changeset 138
d0184734320e
parent 135
ad27ab7e6fb6
child 141
506e951fd338

update

.hgignore file | annotate | diff | comparison | revisions
bt.py file | annotate | diff | comparison | revisions
mod_bt.py file | annotate | diff | comparison | revisions
--- a/.hgignore	Mon May 04 02:46:09 2015 +0300
+++ b/.hgignore	Fri May 08 04:23:48 2015 +0300
@@ -5,3 +5,5 @@
 *.pyc
 zandronum*
 cobalt.cfg
+*.orig
+*.rej
--- a/bt.py	Mon May 04 02:46:09 2015 +0300
+++ b/bt.py	Fri May 08 04:23:48 2015 +0300
@@ -184,3 +184,8 @@
 def post_note (ticket_id, message):
 	btuser, btpassword = credentials()
 	suds_client.service.mc_issue_note_add (btuser, btpassword, ticket_id, { 'text': message })
+
+def custom_query (func, args):
+	btuser, btpassword = credentials()
+	args = [x.replace ('$user', btuser).replace ('$password', btpassword) for x in args]
+	return getattr (suds_client.service, func)(*args)
--- a/mod_bt.py	Mon May 04 02:46:09 2015 +0300
+++ b/mod_bt.py	Fri May 08 04:23:48 2015 +0300
@@ -51,6 +51,13 @@
 			'args': None,
 			'level': 'admin',
 		},
+		
+		{
+			'name': 'btsoap',
+			'description': 'Sends a custom SOAP query',
+			'args': '<func> [args...]',
+			'level': 'admin',
+		},
 	]
 }
 
@@ -61,4 +68,10 @@
 	Bt.announce_new_issue (bot, Bt.get_issue (args['ticket']))
 
 def cmd_checkbt (bot, **rest):
-	Bt.poll()
\ No newline at end of file
+	Bt.poll()
+
+def cmd_btsoap (bot, args, reply, **rest):
+	result = Bt.custom_query (args['func'], args['args'].split (' ') if 'args' in args else [])
+
+	for line in result.splitlines():
+		reply (line)
\ No newline at end of file

mercurial