provide appropriate default definition for sort value; extend identifier query to support '*' queries
This commit is contained in:
parent
288b9f62b2
commit
611ad219fa
2 changed files with 8 additions and 3 deletions
|
@ -149,6 +149,9 @@ class RelationField(Field):
|
||||||
def getValue(self, row):
|
def getValue(self, row):
|
||||||
return self.getRawValue(row)
|
return self.getRawValue(row)
|
||||||
|
|
||||||
|
def getSortValue(self, row):
|
||||||
|
return self.getDisplayValue(row)['title']
|
||||||
|
|
||||||
def getDisplayValue(self, row):
|
def getDisplayValue(self, row):
|
||||||
value = self.getValue(row)
|
value = self.getValue(row)
|
||||||
if value is None:
|
if value is None:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Generic query functionality for retrieving stuff from a loops database.
|
Generic query functionality for retrieving stuff from a loops database.
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from BTrees.IIBTree import IITreeSet
|
from BTrees.IIBTree import IITreeSet
|
||||||
|
@ -58,6 +56,10 @@ def Text(value):
|
||||||
|
|
||||||
@implementer(IQuery)
|
@implementer(IQuery)
|
||||||
def Identifier(value):
|
def Identifier(value):
|
||||||
|
if value.endswith('*'):
|
||||||
|
v1 = value[:-1]
|
||||||
|
v2 = value[:-1] + '\x7f'
|
||||||
|
return Between(identifierIndex, v1, v2)
|
||||||
return Eq(identifierIndex, value)
|
return Eq(identifierIndex, value)
|
||||||
|
|
||||||
@implementer(IQuery)
|
@implementer(IQuery)
|
||||||
|
|
Loading…
Add table
Reference in a new issue