clear cache on remove, do not overwrite query but just set default, within

This commit is contained in:
j 2011-05-29 23:43:33 +02:00
parent 59f7421922
commit abb6f82b80
2 changed files with 12 additions and 5 deletions

View file

@ -31,6 +31,9 @@ def parseCondition(condition, user):
exclude = True exclude = True
else: else:
exclude = False exclude = False
if op == '-':
return parseCondition({'key': k, 'value': v[0], 'operator': '>='}, user) \
& parseCondition({'key': k, 'value': v[1], 'operator': '<'}, user)
if k == 'id': if k == 'id':
v = v.split('/') v = v.split('/')
if len(v) == 2: if len(v) == 2:
@ -40,7 +43,7 @@ def parseCondition(condition, user):
return q return q
if isinstance(v, bool): #featured and public flag if isinstance(v, bool): #featured and public flag
key = k key = k
elif key in ('lat', 'lng', 'area', 'south', 'west', 'north', 'east', 'matches'): elif k in ('lat', 'lng', 'area', 'south', 'west', 'north', 'east', 'matches'):
if op == '>': if op == '>':
key = '%s__gt'%k key = '%s__gt'%k
elif op == '>=': elif op == '>=':
@ -49,7 +52,8 @@ def parseCondition(condition, user):
key = '%s__lt'%k key = '%s__lt'%k
elif op == '<=': elif op == '<=':
key = '%s__lte'%k key = '%s__lte'%k
#default is exact match else: #default is exact match
key = k
else: else:
if op == '=': if op == '=':
key = '%s__iexact'%k key = '%s__iexact'%k

View file

@ -16,9 +16,9 @@ pandora.ui.placesDialog = function() {
content: app.$ui.placesElement = new Ox.ListMap({ content: app.$ui.placesElement = new Ox.ListMap({
height: height - 48, height: height - 48,
places: function(data, callback) { places: function(data, callback) {
return pandora.api.findPlaces($.extend(data, { return pandora.api.findPlaces($.extend({
query: {conditions: [], operator: ''} query: {conditions: [], operator: ''}
}), callback); }, data), callback);
}, },
addPlace: function(data, callback) { addPlace: function(data, callback) {
Ox.print('ADDPLACE', data); Ox.print('ADDPLACE', data);
@ -34,7 +34,10 @@ pandora.ui.placesDialog = function() {
}, },
removePlace: function(data, callback) { removePlace: function(data, callback) {
Ox.print('REMOVEPLACE', data); Ox.print('REMOVEPLACE', data);
pandora.api.removePlace(data.id, callback); pandora.api.removePlace(data.place, function(result) {
Ox.Request.clearCache(); // fixme: remove
callback(result);
});
}, },
width: width width: width
}), }),