Changeset 3082 for trunk


Ignore:
Timestamp:
11/02/10 22:23:11 (9 years ago)
Author:
jukka
Message:

Fixed few serious bugs from error_log and Shota.

Location:
trunk
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/FieldsWidgets.py

    r3077 r3082  
    818818 
    819819    def textOnly(self, instance, **kwargs): 
    820         listofdicts= getattr(instance, 'cleaned_%s' % self.getName(), None) 
    821         return '\n'.join([x['text'] for x in listofdicts])  
     820        listofdicts= getattr(instance, 'cleaned_%s' % self.getName(), []) 
     821        if not listofdicts: 
     822            listofdicts=self.get(instance) 
     823        if listofdicts and isinstance(listofdicts, list): 
     824            return '\n'.join([x['text'] for x in listofdicts]) 
     825        return '' 
     826         
    822827 
    823828    def mergeTranslationSource(self, instance, chapter_list): 
  • trunk/LeMillReference.py

    r3070 r3082  
    162162        return False 
    163163 
     164    def getOnlyText(self): 
     165        """ Don't use bodyText, give description """ 
     166        return self.getDescription() 
     167 
    164168registerType(LeMillReference, PROJECTNAME) 
  • trunk/Material.py

    r3045 r3082  
    5757    def getOnlyText(self): 
    5858        field=self.getField('bodyText') 
    59         return field.textOnly(self) 
    60  
     59        if field: 
     60            return field.textOnly(self) 
     61        if hasattr(self, 'getDescription'): 
     62            return self.getDescription() 
     63        return '' 
    6164 
    6265    def getOnlyRawText(self): 
    63         return '\n'.join([x['text'] for x in self.getRawBodyText()]) 
     66        if hasattr(self, 'getRawBodyText'): 
     67            return '\n'.join([x['text'] for x in self.getRawBodyText()]) 
     68        return '' 
    6469 
    6570    def prepareForPDF(self): 
  • trunk/skins/lemill/activity_edit.cpt

    r3069 r3082  
    3737        </tal:if_translation> 
    3838 
    39         <metal:eula_here use-macro="here/multimediamaterial_edit/macros/eula" /> 
    40  
    4139        <metal:save_buttons use-macro="here/button_macros/macros/save_buttons" /> 
    4240 
  • trunk/skins/lemill/base_translate.cpt

    r2868 r3082  
    7070        </tal:has_document_byline> 
    7171        <metal:use_body use-macro="body_macro"> 
    72        <tal:comment replace="nothing"> 
    73         This is copied here to add form.button to button names 
    74         </tal:comment> 
    75  
    76         <metal:buttons fill-slot="buttons" tal:define="fieldset_index python:fieldsets.index(fieldset); 
    77         n_fieldsets python:len(fieldsets)"> 
    78  
    79          <input type="hidden" 
    80             name="translation" 
    81             value="1" 
    82             /> 
    83         <input type="hidden" 
    84             name="translation_of" 
    85             tal:attributes="value source/UID" 
    86             /> 
    87  
    88         <input class="context" 
    89             tabindex="" 
    90             type="submit" 
    91             name="form.button.form_submit" 
    92             value="Save" 
    93             i18n:attributes="value label_save;" 
    94             tal:attributes="tabindex tabindex/next; 
    95             disabled python:test(isLocked, 'disabled', None);" 
    96             /> 
    97         <input class="standalone" 
    98             tabindex="" 
    99             type="submit" 
    100             name="form.button.cancel" 
    101             value="Cancel" 
    102             i18n:attributes="value label_cancel;" 
    103             tal:attributes="tabindex tabindex/next" 
    104             /> 
    105              
    106              
    107         </metal:buttons> 
    108  
    10972        </metal:use_body> 
    11073        <metal:use_footer use-macro="footer_macro" /> 
  • trunk/skins/lemill/front-page.cpt

    r3069 r3082  
    7373</body> 
    7474</html> 
    75  
    76  
  • trunk/skins/lemill/lemill_activities_view.pt

    r3054 r3082  
    3131        <dt><a i18n:translate="label_languages" href="cloud?base=language">Languages</a></dt> 
    3232        <dd><span tal:repeat="result context/top3languages | nothing"> 
    33             <a href="" tal:attributes="href python:'language?language=%s' % here.url_quote(result)" tal:content="python:here.script_getPrettyLanguage(result)">PLACEHOLDER</a>, </span><a href="rebuildTop3s" tal:condition="context/amIManager">( rebuild top results )</a><a href="cloud?base=language">...</a> 
     33            <a href="" tal:attributes="href python:'browse?language=%s' % here.url_quote(result)" tal:content="python:here.script_getPrettyLanguage(result)">PLACEHOLDER</a>, </span><a href="rebuildTop3s" tal:condition="context/amIManager">( rebuild top results )</a><a href="cloud?base=language">...</a> 
    3434        </dd> 
    3535        <dt><a i18n:translate="label_tags" href=""  tal:attributes="href string:cloud?${lang_filter}base=tags">Tags</a></dt> 
  • trunk/skins/lemill/lemill_tools_view.pt

    r3054 r3082  
    3232        <dt><a i18n:translate="label_languages" href="cloud?base=language">Languages</a></dt> 
    3333        <dd><span tal:repeat="result context/top3languages | nothing"> 
    34             <a href="" tal:attributes="href python:'language?language=%s' % here.url_quote(result)" tal:content="python:here.script_getPrettyLanguage(result)">PLACEHOLDER</a>, </span><a href="rebuildTop3s" tal:condition="context/amIManager">( rebuild top results )</a><a href="cloud?base=language">...</a> 
     34            <a href="" tal:attributes="href python:'browse?language=%s' % here.url_quote(result)" tal:content="python:here.script_getPrettyLanguage(result)">PLACEHOLDER</a>, </span><a href="rebuildTop3s" tal:condition="context/amIManager">( rebuild top results )</a><a href="cloud?base=language">...</a> 
    3535        </dd> 
    3636        <dt><a i18n:translate="label_tags" href=""  tal:attributes="href string:cloud?${lang_filter}base=tags">Tags</a></dt> 
  • trunk/skins/lemill/livesearch_reply.py

    r3052 r3082  
    1818 
    1919def make_link(result): 
    20     full_title=unicode(result[0], 'utf-8', 'ignore') 
     20    full_title=unicode(result[0] or u'', 'utf-8', 'ignore') 
    2121    if len(full_title) >= MAX_TITLE: 
    2222        dots='...' 
  • trunk/skins/lemill/tool_edit.cpt

    r3069 r3082  
    2525                <tal:block metal:use-macro="here/multimediamaterial_edit/macros/minor_edit"/> 
    2626 
    27         <tal:if_translation condition="translation"> 
    28         <input type="hidden" 
    29             name="translation" 
    30             value="1" 
    31             /> 
    32         <input type="hidden" 
    33             name="translation_of" 
    34             tal:attributes="value source/UID" 
    35             /> 
    36         </tal:if_translation> 
    3727        <metal:save_buttons use-macro="here/button_macros/macros/save_buttons" /> 
    38         <input type="hidden" name="form.submitted" value="1" /> 
    39  
    4028        </form> 
    4129            </metal:macro> 
  • trunk/skins/lemill/widget_exercise.pt

    r3074 r3082  
    2424         'fill_in_the_blanks':'here/widget_exercise/macros/view_fill_in_the_blanks', 
    2525         'open_ended':'here/widget_exercise/macros/view_open_ended', 
    26          'exercise':'here/widget_exercise/macros/view_exercise'};"> 
     26         'exercise':'here/widget_exercise/macros/view_exercise', 
     27         'choice':'here/widget_exercise/macros/view_multiple_choices'};"> 
    2728 
    2829        <metal:view_block use-macro="python:path(macro_mapping[type])" /> 
Note: See TracChangeset for help on using the changeset viewer.