1df10ccc3541a87379c77c3937ab3b91aa4c25cf
2 # floof/floof/model/art.py
4 # Copyright (c) 2009 Scribblr
7 # from elixir import Entity, Field, Integer, Unicode
10 from pylons
import config
12 from floof
.lib
.file_storage
import get_path
, save_file
15 title
= Field(Unicode(120))
16 original_filename
= Field(Unicode(120))
18 uploaded_by
= ManyToOne('User')
20 def __init__(self
, **kwargs
):
21 # I wanted to check for the existence of the file, but...
22 # for some reason this FieldStorage object always conditions as falsey.
23 self
.hash = save_file("art", kwargs
.pop('file'))
24 super(Art
, self
).__init__(**kwargs
)
25 # this is what super is doing, pretty much.
26 # for key, value in kwargs.items():
27 # setattr(self, key, value)
33 return get_path("art", self
.hash)