Example #1
0
    def get_cache_status(self, handler=None, url=None):
        if not handler and not url: return False

        try:
            if handler:
                fbc = FBCache.objects.get(user=self.engine.user.user, handler=handler)
            else:
                fbc = FBCache.objects.get(user=self.engine.user.user, url=url)
        except FBCache.DoesNotExist:
            fbc = FBCache()
            fbc.handler = handler
            fbc.url = url
            fbc.save()
            return False

        if fbc.to_refresh:
            return False
        return True
Example #2
0
    def get_cache_status(self, handler=None, url=None):
        if not handler and not url: return False

        try:
            if handler:
                fbc = FBCache.objects.get(user=self.engine.user.user,
                                          handler=handler)
            else:
                fbc = FBCache.objects.get(user=self.engine.user.user, url=url)
        except FBCache.DoesNotExist:
            fbc = FBCache()
            fbc.handler = handler
            fbc.url = url
            fbc.save()
            return False

        if fbc.to_refresh:
            return False
        return True
Example #3
0
    def set_cache(self, handler=None, url=None, content=None):
        if (not handler and not url) or (not handler and not content):
            return False

        try:
            if handler:
                fbc = FBCache.objects.get(user=self.engine.user.user,
                                          handler=handler)
            else:
                fbc = FBCache.objects.get(user=self.engine.user.user, url=url)
        except FBCache.DoesNotExist:
            fbc = FBCache()
            if handler: fbc.handler = handler
            if url: fbc.url = url

        if handler:
            self.engine.request.facebook.fbml.setRefHandle(handler, content)
        if url:
            self.engine.request.facebook.fbml.refreshRefUrl(url)

        fbc.to_refresh = False
        fbc.save()
        return True
Example #4
0
    def set_cache(self, handler=None, url=None, content=None):
        if (not handler and not url) or (not handler and not content): return False

        try:
            if handler:
                fbc = FBCache.objects.get(user=self.engine.user.user, handler=handler)
            else:
                fbc = FBCache.objects.get(user=self.engine.user.user, url=url)
        except FBCache.DoesNotExist:
            fbc = FBCache()
            if handler: fbc.handler = handler
            if url:        fbc.url = url

        if handler:
            self.engine.request.facebook.fbml.setRefHandle(handler, content)
        if url:
            self.engine.request.facebook.fbml.refreshRefUrl(url)

        fbc.to_refresh = False
        fbc.save()
        return True