Ignore:
Timestamp:
10 Mar 2012, 09:45:25 (13 years ago)
Author:
Henrik Bettermann
Message:

In some cases we do no longer need to know the fallback language (= portal language) because the fallback language is already set in the cookie when accessing Kofa for the first time.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r7819 r7833  
    232232    @property
    233233    def introduction(self):
    234         portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    235         lang = self.request.cookies.get('kofa.language', portal_language)
     234        # Here we know that the cookie has been set
     235        lang = self.request.cookies.get('kofa.language')
    236236        html = self.context.description_dict.get(lang,'')
    237237        if html =='':
     238            portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    238239            html = self.context.description_dict.get(portal_language,'')
    239240        if html =='':
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r7819 r7833  
    290290    @property
    291291    def frontpage(self):
    292         portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    293         lang = self.request.cookies.get('kofa.language', portal_language)
     292        lang = self.request.cookies.get('kofa.language')
    294293        html = self.context['configuration'].frontpage_dict.get(lang,'')
    295294        if html =='':
     295            portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    296296            html = self.context[
    297297                'configuration'].frontpage_dict.get(portal_language,'')
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py

    r7819 r7833  
    261261        switched = [] # for log file
    262262        switched_translated = [] # for flash message
    263         portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    264         preferred_language = self.request.cookies.get(
    265             'kofa.language', portal_language)
     263        # Here we know that the cookie has been set
     264        preferred_language = self.request.cookies.get('kofa.language')
    266265        for bed_id in child_id:
    267266            message = self.context[bed_id].switchReservation()
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r7819 r7833  
    662662    @property
    663663    def label(self):
    664         portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    665         lang = self.request.cookies.get('kofa.language', portal_language)
     664        # Here we know that the cookie has been set
     665        lang = self.request.cookies.get('kofa.language')
    666666        level_title = translate(self.context.level_title, 'waeup.kofa',
    667667            target_language=lang)
     
    762762    @property
    763763    def label(self):
    764         portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    765         lang = self.request.cookies.get('kofa.language', portal_language)
     764        # Here we know that the cookie has been set
     765        lang = self.request.cookies.get('kofa.language')
    766766        level_title = translate(self.context.level_title, 'waeup.kofa',
    767767            target_language=lang)
     
    17321732    @property
    17331733    def label(self):
    1734         portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    1735         lang = self.request.cookies.get('kofa.language', portal_language)
     1734        # Here we know that the cookie has been set
     1735        lang = self.request.cookies.get('kofa.language')
    17361736        level_title = translate(self.context.level_title, 'waeup.kofa',
    17371737            target_language=lang)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py

    r7819 r7833  
    7373    def render(self):
    7474        url = self.view.url(self.context.getStudent(), self.link)
    75         portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
    76         lang = self.request.cookies.get('kofa.language', portal_language)
     75        # Here we know that the cookie has been set
     76        lang = self.request.cookies.get('kofa.language')
    7777        text = translate(self.text, 'waeup.kofa',
    7878            target_language=lang)
Note: See TracChangeset for help on using the changeset viewer.