コード例 #1
0
ファイル: test_base.py プロジェクト: PaoloC68/edx-platform
 def problem_location(problem_url_name):
     """
     Create an internal location for a test problem.
     """
     if "i4x:" in problem_url_name:
         return Location.from_deprecated_string(problem_url_name)
     else:
         return TEST_COURSE_KEY.make_usage_key('problem', problem_url_name)
コード例 #2
0
 def problem_location(problem_url_name):
     """
     Create an internal location for a test problem.
     """
     if "i4x:" in problem_url_name:
         return Location.from_deprecated_string(problem_url_name)
     else:
         return TEST_COURSE_KEY.make_usage_key('problem', problem_url_name)
コード例 #3
0
 def to_python(self, location):
     """
     Deserialize to a UsageKey instance: for now it's a location missing the run
     """
     assert isinstance(location, (NoneType, basestring, Location))
     if location == '':
         return None
     if isinstance(location, basestring):
         location = super(UsageKeyField, self).to_python(location)
         return Location.from_deprecated_string(location)
     else:
         return location
コード例 #4
0
ファイル: models.py プロジェクト: PaoloC68/edx-platform
    def to_python(self, value):
        if value is self.Empty or value is None:
            return value

        assert isinstance(value, (basestring, Location))

        if value == '':
            return None

        if isinstance(value, basestring):
            return Location.from_deprecated_string(value)
        else:
            return value
コード例 #5
0
ファイル: models.py プロジェクト: uncletomiwa/edx-platform
    def to_python(self, value):
        if value is self.Empty or value is None:
            return value

        assert isinstance(value, (basestring, Location))

        if value == '':
            return None

        if isinstance(value, basestring):
            return Location.from_deprecated_string(value)
        else:
            return value