diff options
| -rw-r--r-- | bitbake/lib/toaster/orm/models.py | 12 | ||||
| -rw-r--r-- | bitbake/lib/toaster/toastergui/tables.py | 5 | ||||
| -rw-r--r-- | bitbake/lib/toaster/toastergui/widgets.py | 6 |
3 files changed, 16 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 0f725764d5..fb62a55d71 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
| @@ -26,6 +26,7 @@ from django.utils import timezone | |||
| 26 | 26 | ||
| 27 | from django.core import validators | 27 | from django.core import validators |
| 28 | from django.conf import settings | 28 | from django.conf import settings |
| 29 | import django.db.models.signals | ||
| 29 | 30 | ||
| 30 | class GitURLValidator(validators.URLValidator): | 31 | class GitURLValidator(validators.URLValidator): |
| 31 | import re | 32 | import re |
| @@ -1176,3 +1177,14 @@ class LogMessage(models.Model): | |||
| 1176 | message=models.CharField(max_length=240) | 1177 | message=models.CharField(max_length=240) |
| 1177 | pathname = models.FilePathField(max_length=255, blank=True) | 1178 | pathname = models.FilePathField(max_length=255, blank=True) |
| 1178 | lineno = models.IntegerField(null=True) | 1179 | lineno = models.IntegerField(null=True) |
| 1180 | |||
| 1181 | def invalidate_cache(**kwargs): | ||
| 1182 | from django.core.cache import cache | ||
| 1183 | try: | ||
| 1184 | cache.clear() | ||
| 1185 | except Exception as e: | ||
| 1186 | print "Problem with cache backend: Failed to clear cache" | ||
| 1187 | pass | ||
| 1188 | |||
| 1189 | django.db.models.signals.post_save.connect(invalidate_cache) | ||
| 1190 | django.db.models.signals.post_delete.connect(invalidate_cache) | ||
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index 78a7cb095e..9a93ff9aad 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py | |||
| @@ -323,11 +323,6 @@ class LayerRecipesTable(RecipesTable): | |||
| 323 | 323 | ||
| 324 | 324 | ||
| 325 | 325 | ||
| 326 | |||
| 327 | |||
| 328 | |||
| 329 | |||
| 330 | |||
| 331 | # This needs to be staticaly defined here as django reads the url patterns | 326 | # This needs to be staticaly defined here as django reads the url patterns |
| 332 | # on start up | 327 | # on start up |
| 333 | urlpatterns = ( | 328 | urlpatterns = ( |
diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py index b5dfbbc039..8cf6e1bc2d 100644 --- a/bitbake/lib/toaster/toastergui/widgets.py +++ b/bitbake/lib/toaster/toastergui/widgets.py | |||
| @@ -245,6 +245,9 @@ class ToasterTable(View): | |||
| 245 | for key, val in request.GET.iteritems(): | 245 | for key, val in request.GET.iteritems(): |
| 246 | cache_name = cache_name + str(key) + str(val) | 246 | cache_name = cache_name + str(key) + str(val) |
| 247 | 247 | ||
| 248 | for key, val in kwargs.iteritems(): | ||
| 249 | cache_name = cache_name + str(key) + str(val) | ||
| 250 | |||
| 248 | data = cache.get(cache_name) | 251 | data = cache.get(cache_name) |
| 249 | 252 | ||
| 250 | if data: | 253 | if data: |
| @@ -306,8 +309,7 @@ class ToasterTable(View): | |||
| 306 | except FieldError: | 309 | except FieldError: |
| 307 | print "Error: Requested field does not exist" | 310 | print "Error: Requested field does not exist" |
| 308 | 311 | ||
| 309 | |||
| 310 | data = json.dumps(data, indent=2, cls=DjangoJSONEncoder) | 312 | data = json.dumps(data, indent=2, cls=DjangoJSONEncoder) |
| 311 | cache.set(cache_name, data, 10) | 313 | cache.set(cache_name, data, 60*30) |
| 312 | 314 | ||
| 313 | return data | 315 | return data |
