Package gluon :: Module sqlhtml :: Class UploadWidget
[hide private]
[frames] | no frames]

Class UploadWidget

source code

object --+    
         |    
FormWidget --+
             |
            UploadWidget

Instance Methods [hide private]

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
widget(cls, field, value, download_url=None, **attributes)
generates a INPUT file tag.
source code
 
represent(cls, field, value, download_url=None)
how to represent the file:
source code

Inherited from FormWidget (private): _attributes

Static Methods [hide private]
 
is_image(value)
Tries to check if the filename provided references to an image
source code
Class Variables [hide private]
  _class = 'upload'
  DEFAULT_WIDTH = '150px'
  ID_DELETE_SUFFIX = '__delete'
  GENERIC_DESCRIPTION = 'file ## download'
  DELETE_FILE = 'delete'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

widget(cls, field, value, download_url=None, **attributes)
Class Method

source code 

generates a INPUT file tag.

Optionally provides an A link to the file, including a checkbox so the file can be deleted. All is wrapped in a DIV.

see also: :meth:`FormWidget.widget`

:param download_url: Optional URL to link to the file (default = None)

Overrides: FormWidget.widget

represent(cls, field, value, download_url=None)
Class Method

source code 

how to represent the file:

- with download url and if it is an image: <A href=...><IMG ...></A>
- otherwise with download url: <A href=...>file</A>
- otherwise: file

:param field: the field
:param value: the field value
:param download_url: url for the file download (default = None)

is_image(value)
Static Method

source code 

Tries to check if the filename provided references to an image

Checking is based on filename extension. Currently recognized:
   gif, png, jp(e)g, bmp

:param value: filename