deviangularjs / course-builder

Automatically exported from code.google.com/p/course-builder
0 stars 0 forks source link

Bug in Memcache Manager #81

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello i found a small bug that is breaking our CB instance with 500 errors. The 
error is :

  File "/base/data/home/apps/s~miyagi-domain/3-1-0.389328682882999855/models/courses.py", line 2260, in get_environ
    models.MemcacheManager.begin_readonly()
  File "/base/data/home/apps/s~miyagi-domain/3-1-0.389328682882999855/models/models.py", line 149, in begin_readonly
    cls._is_same_app_context_if_set(), 'Unable to switch app_context.')
  File "/base/data/home/apps/s~miyagi-domain/3-1-0.389328682882999855/models/models.py", line 128, in _assert_true_clear_cache_and_raise_if_not
    cls.clear_readonly_cache()
  File "/base/data/home/apps/s~miyagi-domain/3-1-0.389328682882999855/models/models.py", line 178, in clear_readonly_cache
    cls._READONLY_APP_CONTEXT.fs.is_in_readonly):
AttributeError: 'AbstractFileSystem' object has no attribute 'is_in_readonly'

Looking a bit, i found that in models/models.py is calling the next line :

    @classmethod
    def clear_readonly_cache(cls):
        cls._LOCAL_CACHE = None
        cls._IS_READONLY = False
        cls._READONLY_REENTRY_COUNT = 0
        if cls._READONLY_APP_CONTEXT and (
            cls._READONLY_APP_CONTEXT.fs.is_in_readonly): << ----- This is the problem
            cls._READONLY_APP_CONTEXT.fs.end_readonly()
        cls._READONLY_APP_CONTEXT = None

and in the models/vfs.py the correct method name is :

    @property
    def is_readonly(self):
        return self._readonly

Is a small bug, and only is needed to change the call at models/models.py to 
the right one. 

Regards hector.

Original issue reported on code.google.com by hector.r...@gmail.com on 18 Dec 2015 at 9:32