File: ZAATestProduct.py

package info (click to toggle)
zope-zattachmentattribute 2.21-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 324 kB
  • ctags: 238
  • sloc: sh: 1,365; python: 1,311; makefile: 89
file content (81 lines) | stat: -rw-r--r-- 2,491 bytes parent folder | download
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
##############################################################################
#
# Copyright (c) 2002 Ingeniweb SARL
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################

"""Dummy product to test ZAA"""

from Globals import MessageDialog, DTMLFile      # fakes a method from a DTML file
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass
from Acquisition import Implicit
from Globals import Persistent
from AccessControl.Role import RoleManager
from OFS.SimpleItem import Item
from OFS.PropertyManager import PropertyManager
import OFS
from OFS import ObjectManager, SimpleItem, DTMLDocument
from DateTime import DateTime
from App import ImageFile
import AccessControl.Role, webdav.Collection
import Products
import os
import string
import shutil
import random
import re
import AccessControl.Permissions

from Products.ZAttachmentAttribute import ZAttachmentAttribute

def ZAATestProduct_add(self, id, REQUEST = {}):
    """Add ZAATestProduct"""
    id = "toto"
    p = ZAATestProduct(id)
    self._setObject(id, p)
    getattr(self, id)._post_init()
    if REQUEST.has_key('RESPONSE'):
        return self.manage_main(self, REQUEST)
    else:
        return getattr(self, id)


class ZAATestProduct(OFS.SimpleItem.SimpleItem, ):
    """
    ZAATestProduct
    """
    meta_type = 'ZAATestProduct'
    title = "Sample object"
    security = ClassSecurityInfo()

    def __init__(self, id):
        """
        __init__(self, id) -> initialization method
        """
        self._setId(id)
    

    security.declarePrivate('_post_init')
    def _post_init(self):
        """
        _post_init(self) => called from manage_add method
        """
        self.myAttachment = ZAttachmentAttribute.ZAttachmentAttribute(
            AccessControl.Permissions.view_management_screens,
            AccessControl.Permissions.change_images_and_files
            )
        self.myDocument = OFS.DTMLDocument.DTMLDocument('myDocument')
        self.manage_addProduct['OFSP'].addDTMLDocument(id='myDocument2')


   
InitializeClass(ZAATestProduct)