File: Squishfile.py

package info (click to toggle)
squishdot 1.3.0-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 896 kB
  • ctags: 349
  • sloc: python: 2,313; makefile: 56; sh: 54
file content (47 lines) | stat: -rw-r--r-- 1,405 bytes parent folder | download | duplicates (3)
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
##############################################################################  
#   
# This software is released under the Zope Public License (ZPL) Version 1.0
#
# Copyright (c) Digital Creations.  All rights reserved.  
# Portions Copyright (c) 1999 by Butch Landingin.
# Portions Copyright (c) 2000-2001 by Chris Withers.
#   
##############################################################################  
  
__version__='$Revision: 1.7 $'[11:-2]  
  
from AccessControl import ClassSecurityInfo
from OFS.Image import File, cookId
from SquishPermissions import View
import Globals

class Squishfile(File):  
    """ Squishdot File """  

    security = ClassSecurityInfo()

    meta_type = "Squishdot File"
    
    security.declarePrivate('__init__')
    def __init__(self,file=None):        
        if file:
            id, title = cookId(None,None,file)
            File.__init__(self,id,title,file)
  
    security.declareProtected(View, 'icon')
    def icon(self):
        return 'misc_/Squishdot/squishfile_img'

    security.declareProtected(View, 'file_name')
    def file_name(self):
        return self.getId()
  
    security.declareProtected(View, 'file_bytes')
    def file_bytes(self):  
        return self.get_size()
  
    security.declareProtected(View, 'file_kbytes')
    def file_kbytes(self):  
        return int(self.get_size()/1024)  
  
Globals.InitializeClass(Squishfile)