Annotation of ExtFile/IExtFile.py, revision 1.1.1.1
1.1 dwinter 1: #
2: # IExtFile and IExtImage public interfaces
3: #
4:
5: try:
6: from Interface import Interface
7: except ImportError:
8: # Zope < 2.6
9: from Interface import Base as Interface
10:
11:
12: class IExtFile(Interface):
13: '''ExtFile public interface'''
14:
15: def index_html(icon=0, preview=0, width=None, height=None, REQUEST=None):
16: '''The default view. Returns the file's contents.'''
17:
18: def view_image_or_file():
19: '''Redirects to the default view of the file or image.'''
20:
21: def link(text='', **args):
22: '''Returns an HTML link tag for the file or image.'''
23:
24: def is_broken():
25: '''Returns true if the file does not exist in the repository, false otherwise.'''
26:
27: def get_size():
28: '''Returns the size of the file or image.'''
29:
30: def size():
31: '''Returns a formatted, stringified version of the file size.'''
32:
33: def get_filename():
34: '''Returns the filesystem path of the file.'''
35:
36: def getContentType():
37: '''Returns the file's content type (MIME type).'''
38:
39: def static_mode():
40: '''Returns true if EXTFILE_STATIC_PATH is set, false otherwise.'''
41:
42: def static_url():
43: '''Returns the Zope or static URL of a file, depending on static_mode().'''
44:
45: def icon_gif():
46: '''Redirects to the icon for the file's MIME type.'''
47:
48: def icon_tag():
49: '''Returns an HTML image tag for the icon.'''
50:
51: def getIconPath():
52: '''Returns the filesystem path of the icon for the file's MIME type.'''
53:
54: def manage_editExtFile(title='', descr='', REQUEST=None):
55: '''Changes the properties.'''
56:
57: def manage_upload(file='', content_type='', REQUEST=None):
58: '''Uploads a file from a file handle or string buffer.'''
59:
60: def manage_file_upload(file='', content_type='', REQUEST=None):
61: '''Uploads a file from a file handle or local directory.'''
62:
63: def manage_http_upload(url, REQUEST=None):
64: '''Uploads a file from an HTTP server.'''
65:
66: def manage_afterUpdate(filename, content_type, size):
67: '''Called whenever the file data has been updated.'''
68:
69: def PrincipiaSearchSource():
70: '''Returns the contents of text/* files, empty string otherwise.'''
71:
72:
73: class IExtImage(IExtFile):
74: '''ExtImage public interface'''
75:
76: def tag(preview=0, icon=0, height=None, width=None, alt=None,
77: scale=0, xscale=0, yscale=0, border='0', REQUEST=None, **args):
78: '''Returns an HTML image tag for this image.'''
79:
80: def width():
81: '''Returns the pixel width of the main image.'''
82:
83: def height():
84: '''Returns the pixle height of the main image.'''
85:
86: def format():
87: '''Returns the PIL file format of the image.'''
88:
89: def is_webviewable():
90: '''Returns true if the file format is GIF, JPEG, or PNG; false otherwise.'''
91:
92: def preview():
93: '''Redirects to the preview image.'''
94:
95: def preview_tag():
96: '''Returns an HTML image tag for the preview image.'''
97:
98: def get_prev_size():
99: '''Returns the size of the preview image.'''
100:
101: def prev_size():
102: '''Returns a formatted stringified version of the preview image size.'''
103:
104: def prev_width():
105: '''Returns the pixel width of the preview image.'''
106:
107: def prev_height():
108: '''Returns the pixel height of the preview image.'''
109:
110: def get_prev_filename():
111: '''Returns the filesystem path of the preview image.'''
112:
113: def manage_create_prev(maxx=0, maxy=0, ratio=0, REQUEST=None):
114: '''Create the preview from the main image.'''
115:
116: def manage_del_prev(REQUEST=None):
117: '''Deletes the preview image.'''
118:
119: def manage_upload(file='', content_type='', is_preview=0, create_prev=0,
120: maxx='', maxy='', ratio=0, REQUEST=None):
121: '''Uploads an image or preview from a file handle or string buffer.'''
122:
123: def manage_file_upload(file='', content_type='', is_preview=0, create_prev=0,
124: maxx='', maxy='', ratio=0, REQUEST=None):
125: '''Uploads an image or preview from a file handle or local directory.'''
126:
127: def manage_http_upload(url, is_preview=0, REQUEST=None):
128: '''Uploads an image or preview from an HTTP server.'''
129:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>