I can't completely speak for the authors, but the general philosophy of webpy is to make things as simple as possible. There are plenty of areas that could be expanded to include more functionality, but it would deter from the simplistic implementation. It has enough functionality that you can make something work quickly, but adding polish is up to you the developer, not the webpy guys.
What you've done here is makes sense -- I might even go further to make a class ImgButton and pass it the source of the image as an attribute. Cheers, Justin On Sep 2, 5:52 am, "[email protected]" <[email protected]> wrote: > Hi all; > > I was trying to start using web.form; but i just found a problem with > form.Button. > > If i want to use an image on a button (something like <button><img > src="sent.jpg"></button>) i can't, using web.py? > > Neither the description nor value attrs work. The func in > > /usr/lib64/python2.5/site-packages/web.py-0.32-py2.5.egg/web/form.py > > is defined as > > class Button(Input): > def __init__(self, name, *validators, **attrs): > super(Button, self).__init__(name, *validators, **attrs) > self.description = "" > > def render(self): > safename = net.websafe(self.name) > x = '<button name="%s"%s>%s</button>' % (safename, > self.addatts(), safename) > x += self.rendernote(self.note) > return x > > I can use my own Button class using something like > > >>> class MyButton(web.form.Button): > > ... def __init__(self, name, *validators, **attrs): > ... super(web.form.Button, self).__init__(name, *validators, > **attrs) > ... def render(self): > ... safename = web.net.websafe(self.name) > ... if self.description: > ... x = '<button name="%s"%s>%s</button>' % > (safename, self.addatts(), web.net.websafe(self.description)) > ... else: > ... x = '<button name="%s"%s>%s</button>' % > (safename, self.addatts(), safename) > ... x += self.rendernote(self.note) > ... return x > > Or hack it in the form.py file, but i want to know if it's a bug or it's > a feature to know what to do > > Thank you all! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/webpy?hl=en -~----------~----~----~----~------~----~------~--~---
