IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Zope Python Discussion :

[Plone] Problème PropertyManager


Sujet :

Zope Python

  1. #1
    Membre à l'essai
    Inscrit en
    Septembre 2006
    Messages
    15
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 15
    Points : 10
    Points
    10
    Par défaut [Plone] Problème PropertyManager
    Bonjour,
    Je fais un product et j'ai des petits soucis avec PropertyManager.
    Lorsque je fais une instance, d'un type archetype que j'ai créé, dans l'install j'ai un message d'erreur.

    En fait, je n'ai pas trouvé de doc, de faq ou de product suffisament détaillés pour m'en inspirer. (Zope book appendix, Zope develloper's guide et même http://docs.neuroinf.de/programming-plone/appendixA#1-3 devraient suffire mais apparement non....)

    Si quelqu'un a des infos...(pdeoliveira ou senacle m'avaient donné des réponses que je n'ai pas su les exploitées (http://www.developpez.net/forums/sho...d.php?t=218440)

    Je galère un peu mais j'y arriverai!
    Merci bien,
    biz+++


    message d'erreur:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
     
    2006-10-12 11:24:01
    failed:
    Traceback (most recent call last):
     
      File "C:\Program Files\Plone 2\Data\Products\CMFQuickInstallerTool\QuickInstallerTool.py", line 322, in installProduct
        res=install(portal)
     
      File "C:\Program Files\Plone 2\Zope\lib\python\Products\ExternalMethod\ExternalMethod.py", line 225, in __call__
        try: return f(*args, **kw)
     
      File "C:\Program Files\Plone 2\Data\Products\GestionCourrier\Extensions\Install.py", line 25, in install
        new_id1 = folder.invokeFactory(id=id1, type_name=type_name)
     
      File "C:\Program Files\Plone 2\Data\Products\CMFCore\PortalFolder.py", line 408, in invokeFactory
        return pt.constructContent(type_name, self, id, RESPONSE, *args, **kw)
     
      File "C:\Program Files\Plone 2\Data\Products\CMFCore\TypesTool.py", line 932, in constructContent
        raise ValueError('No such content type: %s' % type_name)
     
    ValueError: No such content type: DossierCourrier
    Courrier.py
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
     
    from Products.GestionCourrier.config import ARTICLE_GROUPS1
    from Products.GestionCourrier.config import ARTICLE_GROUPS2
    from Products.Archetypes.public import *
    from Products.Archetypes.Marshall import PrimaryFieldMarshaller
    from Products.CMFCore import CMFCorePermissions
    from config import PROJECTNAME
    from OFS.PropertyManager import PropertyManager
     
     
    schema = BaseSchema +  Schema((
    	StringField('Num_dpt',
    		vocabulary=ARTICLE_GROUPS1,
    		widget=SelectionWidget(label="Numero de departement"),
    		required=1,
    	),
    	StringField('Type',
    		vocabulary=ARTICLE_GROUPS2,
    		widget=SelectionWidget(label="Type"),
    		required=1,
    	),
    	IntegerField('Annee',
    		default='06',
    		widget=IntegerWidget(label="Annee"),
    		required=1,
    	),
    	IntegerField('chrono',
    		widget=IntegerWidget(label="Chrono"),
    		#default_method="incrChrono",
    		#accessor="DossierCourrier.getChrono",
    		required=1,
    	),
    	StringField('Objet',
    		widget=StringWidget(label="Objet"),
    		required=1,
    	),
    	StringField('Destinataire',
    		widget=StringWidget(label="Destinataire"),
    		required=1,
    	),
    	FileField('Fichier',
    		widget=FileWidget(label="Fichier"),
    	),),
          marshall=PrimaryFieldMarshaller(),
    	)
     
    schema2 = BaseBTreeFolderSchema
     
    class DossierCourrier(BaseBTreeFolder, PropertyManager):
    	"""Un simple dossier"""
    	allowed_content_types = ('Courrier',)
    	Initial_view_name = 'folder_listing' 
    	Default_view_method = 'folder_tabular_view'
     
    	schema = schema2
     
    	_properties=(
    		{
    		'id' : 'chrono',
    		'type' : 'int'
    		},)
    		chrono=0
     
    	__ac_permissions__ :
    		('Manage properties', ('manage_addProperty',
    			'manage_editProperties',
    			'manage_delProperties',
    			'manage_changeProperties',)), 
     
    	actions = ({
            'id': 'view',
            'name': 'View',
            'action': 'string:${object_url}/folder_tabular_view',
            'permissions': (CMFCorePermissions.View,)
            },)
     
    registerType(DossierCourrier, PROJECTNAME)
     
    class Courrier(BaseContent):
     
    	schema = schema
     
    	actions = ({
    		'id': 'view',
    		'name': 'View',
    		'action': 'string:${object_url}/courrier_view',
    		'permissions': (CMFCorePermissions.View,)
    	},)
     
    registerType(Courrier, PROJECTNAME)
    Extensions/Install.py
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
     
    from Products.Archetypes.public import listTypes
    from Products.Archetypes.Extensions.utils import installTypes, install_subskin
    from Products.GestionCourrier.config import PROJECTNAME, GLOBALS
    from Products.CMFCore.utils import getToolByName
     
    from StringIO import StringIO
     
    def install(self):
    	out = StringIO()
    	installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME)
     
    	install_subskin(self, out, GLOBALS)
     
    	#initialisation
    	portal = getToolByName(self, "portal_url").getPortalObject()
    	type_name="DossierCourrier"
    	title1="Courrier Emis"
    	title2="Courrier Recu"
     
    	#A changer si besoin est
    	folder=portal
    	id1 = folder.generateUniqueId(type_name)
    	id2 = folder.generateUniqueId(type_name)
     
    	new_id1 = folder.invokeFactory(id=id1, type_name=type_name) 
    	new_id2 = folder.invokeFactory(id=id2, type_name=type_name) 
     
    	if new_id1 is None or new_id1 == "":
    		new_id1 = id1
    	if new_id2 is None or new_id2 == "":
    		new_id2 = id2
     
    	obj1 = getattr(folder, new_id1)
    	obj2 = getattr(folder, new_id2)
     
    	#Nous devons renommer l'objet pour avoir un id lisible
    	kwargs = {"title": title1}
    	obj1.edit(**kwargs)
    	new_id1 = obj1._renameAfterCreation()
     
    	kwargs = {"title": title2}
    	obj2.edit(**kwargs)
    	new_id2 = obj2._renameAfterCreation()
     
    	out.write("Successfully installed %s." % PROJECTNAME)
    	return out.getvalue()

  2. #2
    Membre à l'essai
    Inscrit en
    Septembre 2006
    Messages
    15
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 15
    Points : 10
    Points
    10
    Par défaut salut,
    Comme on me l'a conseillé sur zopera, le plus intelligent c'est faire un tool avec contentItems() qui compte le nbre d'objets dans le dossier...Comme ca en cas de suppr de courrier: pas de problème!
    +++

Discussions similaires

  1. [Plone] Problème modification template colophon
    Par schnito dans le forum Zope
    Réponses: 1
    Dernier message: 30/01/2007, 17h34
  2. Problème d'installation oracle 8.1.7 sous NT
    Par Anonymous dans le forum Installation
    Réponses: 7
    Dernier message: 02/08/2002, 14h18
  3. Problème d'impression
    Par IngBen dans le forum C++Builder
    Réponses: 7
    Dernier message: 22/05/2002, 11h37
  4. Problème avec la mémoire virtuelle
    Par Anonymous dans le forum CORBA
    Réponses: 13
    Dernier message: 16/04/2002, 16h10
  5. Réponses: 6
    Dernier message: 25/03/2002, 21h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo