I have 3 questions that might require a detailed answer. (Links to tutorials or good illustrations would be really helpful)
- How to map URL's to Controller functions. (like URLDispatcher in Django)?
- How to write Controllers in OpenERP? (an additional comparison with Django Views would be great).
- I see something like this in a controller.
class MyController(oeweb.Controller):
_cp_path = '/some-path'
Does _cp_path denote the corresponding URL, assigned to this Controller?
hi all ! i want to upload file in my page, but request cannot get file upload. please tell me why? detail : */ /*line code*/ cgi.FieldStorage(fp=fp, environ=environ) /*cannot get file upload Tks ! my code: /temp = """<html><body>/ /<form method="post" action="/sa/save">/ /<p>File: <input type="file" name="myfile"></p>/ /<p><input type="submit" value="Upload"></p>/ /</form>/ /</body></html>"""/ /class simplecontroller(http.Controller):/ /_cp_path = '/sa'/ /@http./ httprequest [1] /def index(self, req, **kwargs):/ /return temp/ /@http./ httprequest [2] /def save(self, req, **kwargs):/ /environ = req./ httprequest [3] /.environ/ /fp=environ['wsgi.input']/ */fs = cgi.FieldStorage(fp=fp, environ=environ)# page load forever when run to this line/* /f = fs.getfirst('myfile')/ /filepath =req.params.get('myfile')/ /fout = open(filepath,'w') / /fout.write(f.file.read()) / /fout.close() / /return "upload successfully"/ [1] http://terp.vn/forum/tags/httprequest/ [2] http://terp.vn/forum/tags/httprequest/ [3] http://terp.vn/forum/tags/httprequest/