Changeset 3098 for trunk


Ignore:
Timestamp:
11/08/10 17:19:18 (9 years ago)
Author:
jukka
Message:

Fixed bugs found from error_log, mostly to do about strange pieces.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/FieldsWidgets.py

    r3093 r3098  
    5454    # material types use versions of chapter_widgets and are not affected by this 
    5555 
    56     def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False): 
     56    def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False, validating=True): 
    5757        """Basic impl for form processing in a widget""" 
    5858        value = form.get(field.getName(), empty_marker) 
     
    114114        return lt.parse_text(link, start_with_p=False)  
    115115 
    116     def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False): 
     116    def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False, validating=True): 
    117117        """Basic impl for form processing in a widget""" 
    118118        value = form.get(field.getName(), empty_marker) 
     
    142142    security.declarePublic('process_form') 
    143143    def process_form(self, instance, field, form, empty_marker=None, 
    144                      emptyReturnsMarker=False): 
     144                     emptyReturnsMarker=False, validating=True): 
    145145        """Concatenates address + messenger type, but if address already contains something like prefix (word:) then removes it.  
    146146        """ 
     
    173173    security.declarePublic('process_form') 
    174174    def process_form(self, instance, field, form, empty_marker=None, 
    175                      emptyReturnsMarker=False): 
     175                     emptyReturnsMarker=False, validating=True): 
    176176        name = field.getName() 
    177177        otherName = "%s_checkbox" % name 
     
    268268    security.declarePublic('process_form') 
    269269    def process_form(self, instance, field, form, empty_marker=None, 
    270             emptyReturnsMarker=False): 
     270            emptyReturnsMarker=False, validating=True): 
    271271        """ goes through the form, reorganizes chapters if necessary and delivers results to field writer (as dict). """ 
    272272        chapter_type=form.get('chapter_type') 
     
    358358    security.declarePublic('process_form') 
    359359    def process_form(self, instance, field, form, empty_marker=None, 
    360             emptyReturnsMarker=False): 
     360            emptyReturnsMarker=False, validating=True): 
    361361        """ goes through the form and sends changes forward to field writer """ 
    362362        changes, empty= ChapterWidget.process_form(self, instance, field, form) 
     
    414414    security.declarePublic('process_form') 
    415415    def process_form(self, instance, field, form, empty_marker=None, 
    416             emptyReturnsMarker=False): 
     416            emptyReturnsMarker=False, validating=True): 
    417417        """ goes through the form and tries to merge all text inputs to lists, find references to pieces and if file objects are uploaded, just send them forward to field. """ 
    418418        changes, empty= ChapterWidget.process_form(self, instance, field, form) 
     
    546546         
    547547    def process_form(self, instance, field, form, empty_marker=None, 
    548                      emptyReturnsMarker=False): 
     548                     emptyReturnsMarker=False, validating=True): 
    549549        """ Replaces internal links with {uid:UID} and external links with {url} """ 
    550550        fieldname = field.getName() 
  • trunk/GroupBlog.py

    r3094 r3098  
    510510            sortable_results.append((result.created(), r_dict)) 
    511511            url_base=result.absolute_url()  
    512             title='re:%s' % result.Title()                 
    513             for reply in result.getDiscussion().values(): 
    514                 r_dict={'getURL':'#'.join((url_base, reply.id)), 'getLatestEdit':reply.created, 'Title':title, 'listCreators':[reply.Creator()],'Rights':'CC-SA 2.5'} 
    515                 sortable_results.append((reply.created, r_dict)) 
     512            title='re:%s' % result.Title() 
     513            if result and hasattr(result, 'getDiscussion'):                 
     514                for reply in result.getDiscussion().values(): 
     515                    r_dict={'getURL':'#'.join((url_base, reply.id)), 'getLatestEdit':reply.created, 'Title':title, 'listCreators':[reply.Creator()],'Rights':'CC-SA 2.5'} 
     516                    sortable_results.append((reply.created, r_dict)) 
    516517        sortable_results.sort(reverse=True) 
    517518        rez= [x[1] for x in sortable_results[:max]] 
  • trunk/skins/lemill/history_view.pt

    r2680 r3098  
    99        </h1> 
    1010 
    11         <ul> 
    12             <tal:block tal:repeat="entry python:here.getHistoryEntries()[:]"><li i18n:translate="text_version_information" tal:condition="entry/author" tal:define="timestamp python:'%f' % entry['timestamp']"> 
     11        <ul tal:define="entries here/getHistoryEntries | python:[]; entries python:entries[:]"> 
     12            <tal:block tal:repeat="entry entries"><li i18n:translate="text_version_information" tal:condition="entry/author" tal:define="timestamp python:'%f' % entry['timestamp']"> 
    1313            Version <a href="" i18n:name="version" tal:attributes="href string:${here_url}/view?version=${timestamp}" tal:content="entry/version"></a>, 
    1414                <span i18n:name="date"> 
  • trunk/skins/lemill/macros_flowplayer.pt

    r2068 r3098  
    5555</metal:define> 
    5656 
    57 <metal:define define-macro="flowplayer_chapter_view" tal:define="flowPlayerAttributeString python:'config={videoFile: \'%s/at_download/file\'}' % abs_url"> 
     57<metal:define define-macro="flowplayer_chapter_view" tal:define="flowPlayerAttributeString python:'config={videoFile: \'%s/at_download/file\'}' % piece_url"> 
    5858    <span metal:use-macro="here/macros_flowplayer/macros/flowplayer_object" /> 
    5959</metal:define> 
    6060 
    61 <metal:define define-macro="flowplayer_chapter_area_edit" tal:define="flowPlayerAttributeString python:'config={videoFile: \'%s/at_download/file\'}' % abs_url"> 
     61<metal:define define-macro="flowplayer_chapter_area_edit" tal:define="flowPlayerAttributeString python:'config={videoFile: \'%s/at_download/file\'}' % piece_url"> 
    6262    <span metal:use-macro="here/macros_flowplayer/macros/flowplayer_object" /> 
    6363</metal:define> 
    6464 
    65 <metal:define define-macro="flowplayer_method_view" tal:define="flowPlayerAttributeString python:'config={videoFile: \'%s/at_download/video\'}' % abs_url"> 
     65<metal:define define-macro="flowplayer_method_view" tal:define="flowPlayerAttributeString python:'config={videoFile: \'%s/at_download/video\'}' % piece_url"> 
    6666    <span metal:use-macro="here/macros_flowplayer/macros/flowplayer_object" /> 
    6767</metal:define> 
  • trunk/skins/lemill/piece_macros.pt

    r3069 r3098  
    6262 
    6363<metal:piece_macro define-macro="audioplayer_with_download"> 
    64     <tal:mp3block condition="mp3"> 
    6564        <img tal:condition="context/isAudio" 
    6665             src="images/default_soundclip.png"/> 
     
    6867        <metal:audioplayer use-macro="here/macros_audioplayer/macros/audioplayer_plain"/> 
    6968<a class="discreet" tal:attributes="href string:${here_url}/at_download/file">(<tal:block i18n:domain="plone" i18n:translate="Download">Download</tal:block>)</a> 
    70     </tal:mp3block> 
    7169</metal:piece_macro> 
    7270 
     
    9492 
    9593<metal:piece_macro define-macro="download_only"> 
    96     <div tal:condition="python:(not mp3) and (not context.isFLVVideo()) and (not context.isSwf() and (not context.isKml()))"><tal:block i18n:domain="plone" i18n:translate="">Download</tal:block>: <metal:fieldMacro use-macro="python:here.widget('file',mode='view')"/></div> 
    97     <div tal:condition="mp3"><tal:block i18n:translate="label_playing_time">Playing time</tal:block>: <span tal:replace="python:DateTime(context.getLength()).strftime('%M:%S')">3:20</span></div> 
     94    <tal:def define="mp3 mp3 | python:None; this_piece nocall:piece | nocall:context | nothing"><div><tal:block i18n:domain="plone" i18n:translate="">Download</tal:block>: <metal:fieldMacro use-macro="python:this_piece.widget('file',mode='view')"/></div> 
     95    <div tal:condition="mp3"><tal:block i18n:translate="label_playing_time">Playing time</tal:block>: <span tal:replace="python:DateTime(this_piece.getLength()).strftime('%M:%S')">3:20</span></div></tal:def> 
    9896</metal:piece_macro> 
    9997 
  • trunk/skins/lemill/widget_chapter.pt

    r3093 r3098  
    3636        'video':'here/macros_flowplayer/macros/flowplayer_chapter_view'}">     
    3737        <tal:we_got_piece condition="python:piece and not piece.isDeleted()"> 
    38             <metal:view use-macro="python:path(macro_mapping[piece_type])" /> 
     38            <metal:view use-macro="python:path(macro_mapping.get(piece_type,'here/piece_macros/macros/download_only'))" /> 
    3939        </tal:we_got_piece> 
    4040</tal:piece_defs> 
     
    196196            'kml':'here/piece_macros/macros/kml_macro'}">     
    197197        <tal:we_got_piece condition="python:piece and not piece.isDeleted()"> 
    198             <metal:view use-macro="python:path(macro_mapping[piece_type])" /> 
     198            <metal:view use-macro="python:path(macro_mapping.get(piece_type,'here/piece_macros/macros/download_only'))" /> 
    199199        </tal:we_got_piece> 
    200200    </tal:defs> 
Note: See TracChangeset for help on using the changeset viewer.