Changeset 1937


Ignore:
Timestamp:
08/16/07 12:26:37 (12 years ago)
Author:
gabor
Message:

fixed #1487 spent 2h

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FieldsWidgets.py

    r1904 r1937  
    120120        lt = getToolByName(self, 'lemill_tool')  
    121121        return lt.shorten_link_names(lt.htmlify(link))  
     122 
     123    def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False): 
     124        """Basic impl for form processing in a widget""" 
     125        value = form.get(field.getName(), empty_marker) 
     126        if value is empty_marker: 
     127            return empty_marker 
     128        if emptyReturnsMarker and value == '': 
     129            return empty_marker 
     130        if field.getName() == 'home_page': 
     131            if not value.startswith('http://'): 
     132                value = 'http://' + value 
     133        return value, {} 
    122134     
    123135registerWidget(HTMLLinkWidget, 
  • trunk/MemberFolder.py

    r1933 r1937  
    3030from permissions import MODIFY_CONTENT 
    3131from Products.PloneLanguageTool.availablelanguages import countries 
     32from FieldsWidgets import HTMLLinkWidget 
    3233try: 
    3334    from Products.PloneLanguageTool.availablelanguages import languages_english 
     
    163164        ), 
    164165    TextField('home_page', 
    165         widget = StringWidget( 
     166        widget = HTMLLinkWidget( 
    166167             label = 'Homepage', 
    167168             label_msgid = 'label_home_page', 
Note: See TracChangeset for help on using the changeset viewer.