예제 #1
0
 def test_likert_html_output(self):
     """Failing test for #225, AttributeError: __len__" in Plone 2.5.5"""
     rating_req_val = record()
     rating_req_val.__dict__ = {'1':'2','2':'3'}
     request = FakeRequest(topic = 'test subject', replyto='*****@*****.**',
                           comments='test comments', lf=rating_req_val)
     self.failUnless("1: 2, 2: 3" in self.ff1.lf.htmlValue(request))
예제 #2
0
파일: CHMSite.py 프로젝트: eaudeweb/naaya
 def gl_add_site_language_custom(self, language):
     # this is called to handle other types of multilanguage objects
     catalog_tool = self.getCatalogTool()
     for b in self.getCatalogedBrains(meta_type=[METATYPE_NYPHOTOFOLDER, METATYPE_NYPHOTO]):
         x = catalog_tool.getobject(b.data_record_id_)
         try:
             x.add_language(language)
         except:
             pass
     for r in self.objectValues(METATYPE_NYNETREPOSITORY):
         try:
             r.add_language(language)
         except:
             pass
     for gloss in self.objectValues(NAAYAGLOSSARY_CENTRE_METATYPE):
         try:
             language_name = self.gl_get_language_name(language)
             catalog_obj = gloss.getGlossaryCatalog()
             index_extra = record()
             index_extra.default_encoding = "utf-8"
             try:
                 catalog_obj.manage_addIndex(language_name, "TextIndexNG2", index_extra)
             except:
                 pass
             gloss.set_languages_list(language, language_name)
             gloss.updateObjectsByLang(language_name)
             gloss._p_changed = 1
         except:
             pass
예제 #3
0
 def test_len(self):
     from ZPublisher.HTTPRequest import record
     record = record()
     record.a = 1
     record.b = 2
     record.c = 3
     self.assertEqual(len(record), 3)
예제 #4
0
 def test_len(self):
     from ZPublisher.HTTPRequest import record
     record = record()
     record.a = 1
     record.b = 2
     record.c = 3
     self.assertEqual(len(record), 3)
예제 #5
0
 def gl_add_site_language_custom(self, language):
     #this is called to handle other types of multilanguage objects
     catalog_tool = self.getCatalogTool()
     for b in self.getCatalogedBrains(
             meta_type=[METATYPE_NYPHOTOFOLDER, METATYPE_NYPHOTO]):
         x = catalog_tool.getobject(b.data_record_id_)
         try:
             x.add_language(language)
         except:
             pass
     for r in self.objectValues(METATYPE_NYNETREPOSITORY):
         try:
             r.add_language(language)
         except:
             pass
     for gloss in self.objectValues(NAAYAGLOSSARY_CENTRE_METATYPE):
         try:
             language_name = self.gl_get_language_name(language)
             catalog_obj = gloss.getGlossaryCatalog()
             index_extra = record()
             index_extra.default_encoding = 'utf-8'
             try:
                 catalog_obj.manage_addIndex(language_name, 'TextIndexNG2',
                                             index_extra)
             except:
                 pass
             gloss.set_languages_list(language, language_name)
             gloss.updateObjectsByLang(language_name)
             gloss._p_changed = 1
         except:
             pass
 def test_likert_html_output(self):
     """Failing test for #225, AttributeError: __len__" in Plone 2.5.5"""
     rating_req_val = record()
     rating_req_val.__dict__ = {"1": "2", "2": "3"}
     request = FakeRequest(
         topic="test subject", replyto="*****@*****.**", comments="test comments", lf=rating_req_val
     )
     self.assertTrue("1: 2, 2: 3" in self.ff1.lf.htmlValue(request))
예제 #7
0
 def test_iter(self):
     from ZPublisher.HTTPRequest import record
     record = record()
     record.a = 1
     record.b = 2
     record.c = 3
     for k in record:
         self.assertTrue(k in ('a', 'b', 'c'))
예제 #8
0
 def test_repr(self):
     from ZPublisher.HTTPRequest import record
     rec = record()
     rec.a = 1
     rec.b = 'foo'
     r = repr(rec)
     d = eval(r)
     self.assertEqual(d, rec.__dict__)
예제 #9
0
 def test_iter(self):
     from ZPublisher.HTTPRequest import record
     record = record()
     record.a = 1
     record.b = 2
     record.c = 3
     for k in record:
         self.assertTrue(k in ('a','b','c'))
예제 #10
0
 def test_repr(self):
     from ZPublisher.HTTPRequest import record
     rec = record()
     rec.a = 1
     rec.b = 'foo'
     r = repr(rec)
     d = eval(r)
     self.assertEqual(d, rec.__dict__)
 def test_likert_html_output(self):
     """Failing test for #225, AttributeError: __len__" in Plone 2.5.5"""
     rating_req_val = record()
     rating_req_val.__dict__ = {'1': '2', '2': '3'}
     request = FakeRequest(topic='test subject',
                           replyto='*****@*****.**',
                           comments='test comments',
                           lf=rating_req_val)
     self.assertTrue('1: 2, 2: 3' in self.ff1.lf.htmlValue(request))
예제 #12
0
def add_language(glossary, lang, english_name):
    glossary.set_languages_list(lang, english_name)
    glossary.updateObjectsByLang(english_name)

    catalog_obj = glossary.getGlossaryCatalog()
    from ZPublisher.HTTPRequest import record
    index_extra = record()
    index_extra.default_encoding = 'utf-8'
    catalog_obj.manage_addIndex(glossary.cookCatalogIndex(english_name),
                                'TextIndexNG3', index_extra)
def add_language(glossary, lang, english_name):
    glossary.set_languages_list(lang, english_name)
    glossary.updateObjectsByLang(english_name)

    catalog_obj = glossary.getGlossaryCatalog()
    from ZPublisher.HTTPRequest import record
    index_extra = record()
    index_extra.default_encoding = 'utf-8'
    catalog_obj.manage_addIndex(glossary.cookCatalogIndex(english_name),
                                'TextIndexNG3',index_extra)
예제 #14
0
 def handle_search(self, action, data):
     if 'form.created' in self.request.form:
         del self.request.form['form.created']
     if 'created' in data and data['created']:
         created = record()
         created.query = DateTime(str(data['created']))
         created.range = 'min'
         self.request.form['form.created'] = created
     return self._setRedirect('portal_actions', 'global/search',
                              'review_state,SearchableText,Title,Subject,'
                              'Description,created,portal_type,'
                              'listCreators')
    def __generateDefaultIndexes(self):
        available_indexes = self.indexes()
        available_metadata = self.schema()

        #create indexes
        for index in self._getDefaultIndexes():
            if not (index in available_indexes):
                if self._getIndexById(index) == 'TextIndexNG3':
                    p_extras = record()
                    p_extras.default_encoding = 'utf-8'
                    p_extras.splitter_single_chars = 1
                else:
                    p_extras = None
                self.addIndex(index, self._getIndexById(index), p_extras)
            if not (index in available_metadata):
                self.addColumn(index)
예제 #16
0
    def __generateDefaultIndexes(self):
        available_indexes = self.indexes()
        available_metadata = self.schema()

        #create indexes
        for index in self._getDefaultIndexes():
            if not (index in available_indexes):
                if self._getIndexById(index) == 'TextIndexNG3':
                    p_extras = record()
                    p_extras.default_encoding = 'utf-8'
                    p_extras.splitter_single_chars = 1
                else:
                    p_extras = None
                self.addIndex(index, self._getIndexById(index), p_extras)
            if not (index in available_metadata):
                self.addColumn(index)
예제 #17
0
    def test_referenceField(self):
        name = 'refField'
        self.container.atse_addField(self.target1.portal_type, 'default', '', name)

        field_data = {'type': 'ReferenceField',
                      'schemata': 'default', 'name': name,
                      'widget': 'ReferenceBrowserWidget',
                      'label': 'refField', 'storage': 'Attribute',
                      'relationship': 'testRelation'}
        fd = record()
        for key, value in field_data.items():
            setattr(fd, key, value)
        self.container.atse_update(self.target1.portal_type, '', fd,
                                   self.container.REQUEST)
                                   
        self.container.atse_updateManagedSchema(self.target1.portal_type, '', update_all=True)
        self.target1.addReference(self.target2, relationship='testRelation')
        field = self.target1.getField(name)
        self.failUnless(field.getAccessor(self.target1)() == self.target2)
        self.failUnless(field.getEditAccessor(self.target1)() == \
                        self.target2.UID())
newSecurityManager(app, user)

from Testing.makerequest import makerequest
app=makerequest(app)

portal_id = 'openplans'
portal = app._getOb(portal_id)

# !!! YOU MUST SPECIFY 'FROM' AND 'TO' HOSTS HERE OR THIS SCRIPT WON'T
# DO ANYTHING !!!
old_hosts = []
new_host = ''

cat = portal.portal_catalog
if not 'text' in cat.Indexes:
    extra = record()
    extra.doc_attr = 'getText'
    extra.index_type = 'Cosine Measure'
    extra.lexicon_id = 'plaintext_lexicon'
    cat.addIndex('text', 'ZCTextIndex', extra=extra)
    cat.reindexIndex('text', app.REQUEST)
    transaction.get().note("Added and indexed 'text' index")
    transaction.commit()

pathmap = dict()
for old_host in old_hosts:
    matches = cat(text='href="%s' % old_host, Type='Page')
    for match in matches:
        path = match.getPath()
        if path not in pathmap:
            pathmap[path] = match
예제 #19
0
 def test_contains(self):
     from ZPublisher.HTTPRequest import record
     record = record()
     record.a = 1
     self.assertTrue('a' in record)
예제 #20
0
 def _deserialize(kls, data):
     rec = record()
     for key, value in data.items():
         setattr(rec, key, value)
     return rec
예제 #21
0
 def _deserialize(cls, data):
     rec = record()
     for key, value in data.items():
         setattr(rec, key, value)
     return rec
예제 #22
0
    ('none','No structuring'),
    ('publication_year', 'Publication Year'),
    ('portal_type', 'Reference Type'),
    ('AuthorItems', 'Single (Co)Authors'),
    ]
    + BIBLIOTOPIC_EXTENDEDSCHEMATA_STRUCTURAL_LAYOUT
    ))

# monkey patch section
BIBLIOGRAPHY_EXTENDED_SCHEMATA = True

# do not touch this variable structure!!! unless you know what you are doing!!! actually do not touch anything in this file
try:
    import Products.TextIndexNG2
    # extra args for the TextIndexNG2 index to be added to portal_catalog, do not touch!!!
    ting2_extra = record()
    ting2_extra.indexed_fields   = ''
    ting2_extra.default_encoding = 'utf-8'
    ting2_extra.use_converters   = 0
    text_index_type = { 'type': 'TextIndexNG2', 'extra': ting2_extra, }
    
except ImportError:
    # do not at all touch zcti_extra, it is needed to created ZCTextIndex catalog indexes
    zcti_extra = record()
    zcti_extra.lexicon_id = 'plone_lexicon'
    zcti_extra.index_type = 'Okapi BM25 Rank'
    zcti_extra.doc_attr   = None
    text_index_type = { 'type': 'ZCTextIndex', 'extra': zcti_extra, }
    
try: 
    from Products.CMFBibliographyAT_extended_schemata.config import BIBLIOTOPIC_EXTENDEDSCHEMATA_CRITERIAFIELDS
예제 #23
0
 def test_contains(self):
     from ZPublisher.HTTPRequest import record
     record = record()
     record.a = 1
     self.assertTrue('a' in record)
예제 #24
0
 def _makeOne(self):
     from ZPublisher.HTTPRequest import record
     return record()
예제 #25
0
 def _makeOne(self):
     from ZPublisher.HTTPRequest import record
     return record()