def href_button(self, url, text, title=None, icon_name=None, **kw): """Returns an etree object of a ``<a href>`` tag to the given URL `url`. `url` is what goes into the `href` part. If `url` is `None`, then we return just a ``<b>`` tag. `text` is what goes between the ``<a>`` and the ``</a>``. This can be either a string or a tuple (or list) of strings (or etree elements). """ # logger.info('20121002 href_button %s', unicode(text)) if title: # Remember that Python 2.6 doesn't like if title is a Promise kw.update(title=str(title)) #~ return xghtml.E.a(text,href=url,title=title) if not isinstance(text, (tuple, list)): text = (text,) text = forcetext(text) if url is None: return E.b(*text) kw.update(href=url) if icon_name is not None: src = settings.SITE.build_static_url( 'images', 'mjames', icon_name + '.png') img = E.img(src=src, alt=icon_name) return E.a(img, **kw) else: return E.a(*text, **kw)
def href_button(self, url, text, title=None, icon_name=None, **kw): """Return an etree element of a ``<a href>`` tag to the given URL `url`. `url` is what goes into the `href` part. If `url` is `None`, then we return just a ``<b>`` tag. `text` is what goes between the ``<a>`` and the ``</a>``. This can be either a string or a tuple (or list) of strings (or etree elements). """ # logger.info('20121002 href_button %s', unicode(text)) if title: # Remember that Python 2.6 doesn't like if title is a Promise kw.update(title=str(title)) #~ return xghtml.E.a(text,href=url,title=title) if not isinstance(text, (tuple, list)): text = (text,) text = forcetext(text) if url is None: return E.b(*text) kw.update(href=url) if icon_name is not None: src = settings.SITE.build_static_url( 'images', 'mjames', icon_name + '.png') img = E.img(src=src, alt=icon_name) return E.a(img, **kw) else: return E.a(*text, **kw)
def image(self, ar): url = self.get_image_url(ar) return E.a(E.img(src=url, width="100%"), href=url, target="_blank")
def image(self, ar): url = self.get_image_url(ar) return E.a(E.img(src=url, width="100%"), href=url, target="_blank")