Package platecom :: Package langview :: Package tests :: Module helpers
[hide private]
[frames] | no frames]

Source Code for Module icsemantic.langfallback.tests.helpers

 1  # -*- coding: UTF-8 -*- 
 2  ################################################################################ 
 3  # 
 4  # Copyright (c) 2008, Juan Pablo Giménez <jpg@rcom.com.ar>, and 
 5  #                              the respective authors. All rights reserved. 
 6  # 
 7  # Redistribution and use in source and binary forms, with or without 
 8  # modification, are permitted provided that the following conditions are met: 
 9  # 
10  # * Redistributions of source code must retain the above copyright notice, this 
11  #   list of conditions and the following disclaimer. 
12  # * Redistributions in binary form must reproduce the above copyright notice, 
13  #   this list of conditions and the following disclaimer in the documentation 
14  #   and/or other materials provided with the distribution. 
15  # * Neither the name of the author nor the names of its contributors may be used 
16  #   to endorse or promote products derived from this software without specific 
17  #   prior written permission. 
18  # 
19  # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED 
20  # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
21  # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS 
22  # FOR A PARTICULAR PURPOSE. 
23  # 
24  ################################################################################ 
25  from Products.Archetypes import atapi 
26  from Products.ATContentTypes.content.base import registerATCT 
27  from Products.ATContentTypes.content.document import ATDocument 
28  from Products.ATContentTypes.content import schemata 
29  from Products.ATContentTypes.content.schemata import finalizeATCTSchema 
30  from Products.CMFCore.utils import getToolByName 
31   
32  from platecom.utils.fieldproperty import ATFieldProperty, \ 
33                                           ATFieldMultilingualProperty 
34   
35  from platecom.langview import LangviewMessageFactory as _ 
36  from platecom.langview.config import PROJECTNAME 
37   
38  # ATMock schema, campos de archetype para nuestra clase de Mock 
39  ATMockSchema = ATDocument.schema.copy() + atapi.Schema(( 
40      atapi.StringField('textoMultilingue', 
41          required=False, 
42          searchable=True, 
43          storage=atapi.AnnotationStorage(), 
44          widget=atapi.StringWidget(label=_(u"Multilingual text"), 
45                                    description=_(u""), 
46                                    ) 
47          ), 
48          )) 
49  finalizeATCTSchema(ATMockSchema) 
50   
51 -class ATMock(ATDocument):
52 """ Describe a ATMock. 53 ATMock es una clase de archetypes para hacer pruebas en los tests. 54 No debe cargarse en una instalacion estandar del sistema. 55 """ 56 57 portal_type = meta_type = archetype_name = 'ATMock' 58 _at_rename_after_creation = True 59 schema = ATMockSchema 60 global_allow = True 61 62 __implements__ = ATDocument.__implements__ 63 actions = ATDocument.actions 64 65 # FieldProperty accessors, uno prueba el modo comun de hacerlo 66 # el otro utiliza accessors multilingues... 67 multilingual_text = ATFieldProperty('textoMultilingue') 68 multilingual_title = ATFieldMultilingualProperty('title')
69 70 registerATCT(ATMock, PROJECTNAME) 71