-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #522 from pretaweb/pretaweb-display-field-index
Index computed display fields
- Loading branch information
Showing
8 changed files
with
114 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import unittest | ||
from AccessControl.unauthorized import Unauthorized | ||
from DateTime import DateTime | ||
import Missing | ||
from decimal import Decimal | ||
from Products.CMFPlomino.testing import PLOMINO_FUNCTIONAL_TESTING | ||
from Products.CMFPlomino.config import TIMEZONE | ||
import Products.CMFPlomino.PlominoUtils as utils | ||
|
||
|
||
class DisplayFieldIndexTest(unittest.TestCase): | ||
|
||
layer = PLOMINO_FUNCTIONAL_TESTING | ||
|
||
def setUp(self): | ||
self.portal = self.layer['portal'] | ||
self.db = self.portal.mydb | ||
self.db.invokeFactory('PlominoForm', id='frm1', title='Form 1') | ||
self.frm1 = self.db.frm1 | ||
self.frm1.invokeFactory('PlominoField', id='a_field', | ||
Title='Display Field', | ||
FieldType="TEXT", | ||
FieldMode="DISPLAY", | ||
ToBeIndexed="True", | ||
Formula="return 'spam'") | ||
self.field_obj = self.frm1.a_field | ||
self.field_obj.at_post_create_script() | ||
|
||
def test_indexed_attrs(self): | ||
doc1 = self.db.createDocument() | ||
doc1.setItem('Form', 'frm1') | ||
doc1.save() | ||
doc_id = doc1.id | ||
res = self.db.getIndex().dbsearch({'a_field': 'notspam'}) | ||
self.assertEquals(len(res), 0) | ||
res = self.db.getIndex().dbsearch({'a_field': 'spam'}) | ||
self.assertEquals(len(res), 1) | ||
#import pdb; pdb.set_trace() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters