def display_value(self): url = text = websafe(self.value) or self.default if url: if not (url.startswith('http') or url.startswith('ftp:')): url = 'http://' + url if not self.trim and not (text.startswith('http://') or text.startswith('ftp:')): text = 'http://' + text if self.trim and text.startswith('http://'): text = text[7:] if self.trim and text.endswith('/'): text = text[:-1] url = url[:-1] return self.visible and url and ('<a target="_window" href="%s">%s</a>' % (url, text)) or ''
def render_search(value): CLEAR_LAYOUT = '<span class="clear"><a href="%s"><img src="/static/dz/images/remove_filter.png"></a></span>' SEARCH_FIELDS = '<input type="text" class="text_field" id="search_text" name="q" value="%s">%s<input class="search_button" type=submit value="Search">' SEARCH_BUTTON = '<input class="search_button" type=submit value="Search">' SEARCH_LAYOUT = '<div class="search">%s</div>' if value == None: return '' elif value == '': clear = '<span class="clear"></span>' else: clear = CLEAR_LAYOUT % ('/'.join([''] + route + ['clear'])) return SEARCH_LAYOUT % form_for(SEARCH_FIELDS % (websafe(value),clear), method='GET')
def render_search(value): CLEAR_LAYOUT = '<span class="clear"><a href="%s"><img src="/static/dz/images/remove_filter.png"></a></span>' SEARCH_FIELDS = '<input type="text" class="text_field" id="search_text" name="q" value="%s">%s<input class="search_button" type=submit value="Search">' SEARCH_BUTTON = '<input class="search_button" type=submit value="Search">' SEARCH_LAYOUT = '<div class="search">%s</div>' if value == None: return '' elif value == '': clear = '<span class="clear"></span>' else: clear = CLEAR_LAYOUT % ('/'.join([''] + route + ['clear'])) return SEARCH_LAYOUT % form_for( SEARCH_FIELDS % (websafe(value), clear), method='GET')
def display_value(self): return self.visible and websafe(self.value) or self.default or ''