コード例 #1
0
ファイル: researcher.py プロジェクト: jrwdunham/old-webapp
    def editsettings(self, id):
        """Edit the logged in researcher's settings.
        
        """

        if id is None:
            abort(404)

        researcher_q = meta.Session.query(model.User)
        c.researcher = researcher_q.get(int(id))
        if c.researcher is None:
            abort(404)

        # Get the researcher's settings from the pickle file in
        #  files/researchers/username/username.pickle
        c.researcherSettings = h.unpickleResearcherSettings(c.researcher)

        values = {
            "inputOrthography": c.researcherSettings.get("inputOrthography"),
            "outputOrthography": c.researcherSettings.get("outputOrthography"),
            "defaultMetadataFromPreviousForm": c.researcherSettings.get("defaultMetadataFromPreviousForm"),
            "defaultFormView": c.researcherSettings.get("defaultFormView"),
            "guessMorphology": c.researcherSettings.get("guessMorphology"),
            "dateFormat": c.researcherSettings.get("dateFormat"),
        }

        html = render("/derived/people/researcher/editsettings.html")

        return htmlfill.render(html, defaults=values)
コード例 #2
0
ファイル: researcher.py プロジェクト: pombredanne/old-webapp
    def editsettings(self, id):
        """Edit the logged in researcher's settings.
        
        """

        if id is None:
            abort(404)

        researcher_q = meta.Session.query(model.User)
        c.researcher = researcher_q.get(int(id))
        if c.researcher is None:
            abort(404)

        # Get the researcher's settings from the pickle file in
        #  files/researchers/username/username.pickle
        c.researcherSettings = h.unpickleResearcherSettings(c.researcher)

        values = {
            'inputOrthography':
            c.researcherSettings.get('inputOrthography'),
            'outputOrthography':
            c.researcherSettings.get('outputOrthography'),
            'defaultMetadataFromPreviousForm':
            c.researcherSettings.get('defaultMetadataFromPreviousForm'),
            'defaultFormView':
            c.researcherSettings.get('defaultFormView'),
            'guessMorphology':
            c.researcherSettings.get('guessMorphology'),
            'dateFormat':
            c.researcherSettings.get('dateFormat')
        }

        html = render('/derived/people/researcher/editsettings.html')

        return htmlfill.render(html, defaults=values)
コード例 #3
0
ファイル: researcher.py プロジェクト: jrwdunham/old-webapp
    def saveuserdisplaysetting(self):
        """Asynchronously saves the user's form add display settings, i.e.,
        whether the narrow or broad phonetic transcription fields will be
        displayed or not.  See the saveUserDisplaySetting JS function in
        functions.js.
        
        """

        value = {"true": True, "false": False}[request.params["value"]]
        setting = request.params["setting"]
        researcher = meta.Session.query(model.User).get(session["user_id"])
        researcherSettings = h.unpickleResearcherSettings(researcher)
        researcherSettings[setting] = value
        h.pickleResearcherSettings(researcherSettings, researcher)
        session["userSettings"] = researcherSettings
        session.save()
コード例 #4
0
ファイル: researcher.py プロジェクト: pombredanne/old-webapp
    def saveuserdisplaysetting(self):
        """Asynchronously saves the user's form add display settings, i.e.,
        whether the narrow or broad phonetic transcription fields will be
        displayed or not.  See the saveUserDisplaySetting JS function in
        functions.js.
        
        """

        value = {'true': True, 'false': False}[request.params['value']]
        setting = request.params['setting']
        researcher = meta.Session.query(model.User).get(session['user_id'])
        researcherSettings = h.unpickleResearcherSettings(researcher)
        researcherSettings[setting] = value
        h.pickleResearcherSettings(researcherSettings, researcher)
        session['userSettings'] = researcherSettings
        session.save()
コード例 #5
0
ファイル: researcher.py プロジェクト: jrwdunham/old-webapp
    def settings(self, id):
        """View the logged in researcher's settings.
        
        """

        if id is None:
            abort(404)

        researcher_q = meta.Session.query(model.User)
        c.researcher = researcher_q.get(int(id))
        if c.researcher is None:
            abort(404)

        # Get the researcher's settings from the pickle file in
        #  files/researchers/username/username.pickle
        c.researcherSettings = h.unpickleResearcherSettings(c.researcher)

        return render("/derived/people/researcher/settings.html")
コード例 #6
0
ファイル: researcher.py プロジェクト: pombredanne/old-webapp
    def settings(self, id):
        """View the logged in researcher's settings.
        
        """

        if id is None:
            abort(404)

        researcher_q = meta.Session.query(model.User)
        c.researcher = researcher_q.get(int(id))
        if c.researcher is None:
            abort(404)

        # Get the researcher's settings from the pickle file in
        #  files/researchers/username/username.pickle
        c.researcherSettings = h.unpickleResearcherSettings(c.researcher)

        return render('/derived/people/researcher/settings.html')