Hi
I'm trying to make a simple webfrontend to manage a AV receiver via telnet.
The AVController class contains the telnet communication and lists of
devices and telnet commands. When i send a command from Index to /send, i
want the telnet reply and the command returned. But im not getting anything
returned in $status and $selected parses the url and add /send to the
variable every time i click,
"send/send/send/send/send/send/send/send/SndOn". How to return the reply
and still keep the "pretty url"? Or is there a better way.
/Lars
--------------------------------
import web
from av_telnet import AVController
av = AVController()
render = web.template.render('templates/')
urls = (
'/(.*)', 'index',
'/read','read_output',
'/send/(.*)','send_cmd',
'/select/(.*)','select_device'
)
class index:
def GET(self,selected=None,status=None):
av_list = av.get_commandnames()
dev_list = av.get_devicenames()
return render.index(av_list,dev_list,selected,status)
class send_cmd:
def GET(self, cmd):
s = "test"
resplay = av.send(cmd)
web.redirect('/',cmd,reply)
class select_device:
def GET(self, dev):
return "Select dev: {0}".format(dev)
----------- Simple test index.html --------------
$def with (cmds,devs,selected,status)
Select: $selected
Status: $status
<br>
$for item in cmds:
<a href="send/$item">$item</a><br>
<br>
$for item in devs:
<a href="select/$item">$item</a><br>
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/d/optout.