List Info

Thread:




country flaguser name
Italy
2007-05-13 06:44:16
In a content type of mine (subclassed from RichDocument)
when I try to
translate the content to another language I receive the
following error:

Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 41, in call_object
  Module
Products.CMFFormController.FSControllerPythonScript, line
104, in
__call__
  Module Products.CMFFormController.Script, line 145, in
__call__
  Module Products.CMFCore.FSPythonScript, line 108, in
__call__
  Module Shared.DC.Scripts.Bindings, line 311, in __call__
  Module Shared.DC.Scripts.Bindings, line 348, in
_bindAndExec
  Module Products.CMFCore.FSPythonScript, line 164, in
_exec
  Module None, line 12, in createTranslation
   - <FSControllerPythonScript at
/mysite/createTranslation used for
/mysite/catalogue/content-id>
   - Line 12
  Module Products.LinguaPlone.I18NBaseObject, line 121, in
addTranslation
AttributeError: translation_mutator


Obviously, I inserted the usual code in the content type
definition to make
the product LinguaPlone aware.

Some fields are language independent, some others are not. I
put the class
definition at the bottom of this email.

My environment is:
Zope 2.9.4 | Plone 2.5.2 | Lingua Plone 0.9.0 (Revision:
10093)

Can anyone show to me what is the mistake, please?
Best regards,
 Enzo Cesanelli



------------------------------------------------------------
---------------


from AccessControl import ClassSecurityInfo,
ModuleSecurityInfo

from Products.CMFCore.utils import getToolByName
from Products.Archetypes.public import DisplayList
from Products.Archetypes.public import *

from Products.RichDocument import *
from Products.RichDocument.content.richdocument import
RichDocument
from Products.RichDocument.content.richdocument import
RichDocumentSchema

from Products.ATVocabularyManager.namedvocabulary import *

try:
    from Products.LinguaPlone.public import *
except ImportError:
    # No multilingual support
    from Products.Archetypes.public import *

# Added from RichDoc
from Products.RichDocument.interfaces import IRichDocument
from Products.RichDocument.widget.attachments import
AttachmentsManagerWidget
from Products.RichDocument.widget.images import
ImagesManagerWidget

from Products.ATContentTypes.content.document import
ATDocument
from Products.ATContentTypes.content.document import
finalizeATCTSchema
from Products.CMFPlone.interfaces.NonStructuralFolder
import
INonStructuralFolder

from Products.FinanceFields.MoneyField import *
from Products.FinanceFields.Money import *
from Products.FinanceFields.MoneyWidget import *
from Products.FinanceFields.FixedPointField import *
from Products.FinanceFields.fixedpoint import *
from Products.FinanceFields.CurrencyField import *
from Products.FinanceFields.Currency import *

from Products.DataGridField import DataGridField,
DataGridWidget
from Products.DataGridField.Column import Column
from Products.DataGridField.SelectColumn import
SelectColumn

from Products.CMFCore.permissions import
ReviewPortalContent


contact_schema = Schema((

        StringField('producer',
                languageIndependent = 1,
                required=1,
                vocabulary =
NamedVocabulary('producers-list'),
                index='KeywordIndex',
                multiValued=1,
               
widget=MultiSelectionWidget(label_msgid="label_producer
",
                                    label='Producer',
                                   
i18n_domain="atmachine"),
            ),     

        StringField('category',
                languageIndependent = 1,
                required=1,
                vocabulary =
NamedVocabulary('categories-list'),
                index='KeywordIndex',
                multiValued=1,
               
widget=MultiSelectionWidget(label_msgid="label_category
",
                                    label='Category',
                                   
i18n_domain="atmachine"),
            ),   

         StringField('condition',
                languageIndependent = 1,
                required=1,
                vocabulary =
NamedVocabulary('status-list'),
                index='KeywordIndex',
                multiValued=0,
               
widget=MultiSelectionWidget(label_msgid="label_conditio
n",
                                    label='Condition',
                                   
i18n_domain="atmachine"),
            ),   
                
        MoneyField('price',
                languageIndependent = 1,
                required=0,
                index='FieldIndex',
               
widget=MoneyWidget(label_msgid="label_price",
                                    label='Price',
                                   
i18n_domain="atmachine"),
             ),

         StringField('where',
                required=0,
                searchable=1,
                index='FieldIndex',
               
widget=StringWidget(label_msgid="label_where",
                                    label='Where',
                                    description='Where the
Machine is
available',
                                   
i18n_domain="atmachine"),
             ),
             
         DataGridField('techspecs',
                searchable=1,
                columns=("spectype",
"specvalue"),
                widget=DataGridWidget(
                           columns={
                                'spectype' :
Column("Spec Type"),
                                'specvalue' :
Column("Spec Value"),
                                },
                              
label_msgid="label_techspecs",
                                    label='Tech Specs',
                                   
i18n_domain="atmachine"),
             ),

        BooleanField('displayImages',
            default=False,
            languageIndependent=1,
            widget=ImagesManagerWidget(
                description="If selected, a list of
uploaded images will be
"
                             "presented at the bottom
of the document to
allow "
                             "them to be easily
downloaded.",
               
description_msgid='RichDocument_help_displayImages',
                i18n_domain='richdocument',
                label="""Display images
download box""",
               
label_msgid='RichDocument_label_displayImages',
            ),
        ),

        BooleanField('displayAttachments',
            default=True,
            languageIndependent=1,
            widget=AttachmentsManagerWidget(
                description="If selected, a list of
uploaded attachments
will be "
                             "presented at the bottom
of the document to
allow "
                             "them to be easily
downloaded",
               
description_msgid='RichDocument_help_displayAttachments',
                i18n_domain='richdocument',
                label="""Display attachments
download box""",
               
label_msgid='RichDocument_label_displayAttachments',
            ),
        ),
                

    ))


content_schema = RichDocumentSchema.copy() + contact_schema

class machine(RichDocument):
    security = ClassSecurityInfo()
    schema = content_schema
    portal_type = meta_type = 'ATMachine'
#     title='Machine'
    archetype_name=' Machine'
    content_icon = ' machine.png'
    global_allow = 1

    # Allow images and files to be uploaded into this
containerish object
    allowed_content_types = ['ImageAttachment',
'FileAttachment']

    # Set up our views - these are available from the
'display' menu
    default_view = 'atmachine_view'
    immediate_view = 'view'
    #suppl_views = ('richdocument_view_preview',
'richdocument_view_float')
    suppl_views = ()

    # Make sure we get title-to-id generation when an object
is created
    _at_rename_after_creation = True

    __implements__ = OrderedBaseFolder.__implements__ + 
                     ATDocument.__implements__ + 
                     (IRichDocument, INonStructuralFolder,)

    my_actions = (
                { 'id': 'view',
                  'name': 'View',
                  'action':
'string:$/atmachine_view',
                  'visible': 1,
                  'category':'object',
                  },

                { 'id': 'metadata',
                  'name': 'Properties',
                  'action':
'string:$/base_metadata',
                  'visible': 1,
                  'category':'object',
                  },

                { 'id': 'local_roles',
                  'name': 'Sharing',
                  'action': 'string:$/sharing',
                  'visible': 1,
                  'permissions': (ReviewPortalContent,),
                  'category':'object',
                  },

                )
        # Get the standard actions (tabs)
    actions = ATDocument.actions + my_actions

    aliases = {
        '(Default)'  : 'atmachine_view',
        'view'       : '(selected layout)',
        'index.html' : '(dynamic view)',
        'edit'       : 'atct_edit',
        'properties' : 'base_metadata',
        'sharing'    : 'folder_localrole_form',
        'gethtml'    : '',
        'mkdir'      : '',
        }
    # This method, from ISelectableBrowserDefault, is used
to check whether
    # the "Choose content item to use as deafult
view" option will be
    # presented. This makes sense for folders, but not for
RichDocument, so
    # always disallow
    def canSetDefaultPage(self):
        return False
    
    
    # enable FTP/WebDAV and friends
    PUT = ATDocument.PUT

registerType(machine)





------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Plone-i18n mailing list
Plone-i18nlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plone-i18n

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )