Browse Source

added page response to server.py requests

version-14
Rushabh Mehta 13 years ago
parent
commit
7c6c2bc2ca
1 changed files with 12 additions and 4 deletions
  1. +12
    -4
      py/webnotes/handler.py

+ 12
- 4
py/webnotes/handler.py View File

@@ -188,11 +188,11 @@ def handle():
except: except:
webnotes.errprint(webnotes.utils.getTraceback()) webnotes.errprint(webnotes.utils.getTraceback())
webnotes.conn and webnotes.conn.rollback() webnotes.conn and webnotes.conn.rollback()
print_response()

if webnotes.conn: if webnotes.conn:
webnotes.conn.close() webnotes.conn.close()
print_response()


def execute_cmd(cmd): def execute_cmd(cmd):
"""execute a request as python module""" """execute a request as python module"""
@@ -259,9 +259,17 @@ def print_response():
print_iframe() print_iframe()
elif webnotes.response.get('type')=='download': elif webnotes.response.get('type')=='download':
print_raw() print_raw()
elif webnotes.response.get('type')=='page':
print_page()
else: else:
print_json() print_json()

def print_page():
"""print web page"""
from website.utils import render
render(webnotes.response['page_name'])

def print_csv(): def print_csv():
print "Content-Type: text/csv" print "Content-Type: text/csv"
print "Content-Disposition: attachment; filename="+webnotes.response['doctype'].replace(' ', '_')+".csv" print "Content-Disposition: attachment; filename="+webnotes.response['doctype'].replace(' ', '_')+".csv"


Loading…
Cancel
Save