Package omeroweb :: Package webadmin :: Package controller :: Module uploadfile
[hide private]
[frames] | no frames]

Source Code for Module omeroweb.webadmin.controller.uploadfile

 1  #!/usr/bin/env python 
 2  #  
 3  #  
 4  #  
 5  # Copyright (c) 2008 University of Dundee.  
 6  #  
 7  # This program is free software: you can redistribute it and/or modify 
 8  # it under the terms of the GNU Affero General Public License as 
 9  # published by the Free Software Foundation, either version 3 of the 
10  # License, or (at your option) any later version. 
11  #  
12  # This program is distributed in the hope that it will be useful, 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
15  # GNU Affero General Public License for more details. 
16  #  
17  # You should have received a copy of the GNU Affero General Public License 
18  # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
19  #  
20  # Author: Aleksandra Tarkowska <A(dot)Tarkowska(at)dundee(dot)ac(dot)uk>, 2008. 
21  #  
22  # Version: 1.0 
23  # 
24   
25  from omero.rtypes import * 
26  from omero.model import ExperimenterAnnotationLinkI 
27   
28  from django.utils.encoding import smart_str 
29   
30  from webadmin.controller import BaseController 
31   
32 -class BaseUploadFile(BaseController):
33
34 - def __init__(self, conn):
36
37 - def attach_photo(self, newFile):
38 if newFile.content_type.startswith("image"): 39 f = newFile.content_type.split("/") 40 format = f[1].upper() 41 else: 42 format = newFile.content_type 43 44 self.conn.uploadMyUserPhoto(smart_str(newFile.name), format, newFile.read())
45