<commit_before>'''
Created on Dec 30, 2010

@author: <NAME>
'''

from django.http import HttpResponse

from django.shortcuts import render_to_response
from utils import *

from google.appengine.api import users

import logging

logger = logging.getLogger(__name__)

def index(request):
    return render_to_response(getHtmlPath(__name__,'base.html'))

#class MyFile(file):
#    def __init__(self, pDownloadFile, pUser, *args, **kwargs):
#       self.downloadFile = pDownloadFile
#       self.user = pUser
#       lFilename = pDownloadFile
#       #print lFilename
#       super(MyFile, self).__init__(lFilename, *args, **kwargs)
#       logger.info("%s started downloading SriShell")
#
#    def close(self):
#       super(MyFile, self).close()
#       logger.info("%s ended downloading SriShell")
##       lDownloadLog = DownloadLog()
##       lDownloadLog.filename = self.downloadFile.file.name
##       lDownloadLog.lastChangedBy = self.user
##       lDownloadLog.owner = self.user
##       lDownloadLog.save()


def srishell_download(request):
    """
    Download file to browser
    """
    
    print "\r\n"*2
    print "O"*100

    print \
    """Content-Type:application/octet-stream
Content-Disposition:attachment; filename=SriShell_setup.exe
"""
    print open("templates/srishell/download/setup.exe",'rb').read()
    exit()
#    lFile = MyFile("templates/srishell/download/setup.exe", users.get_current_user())
    lResponse = HttpResponse(open("templates/srishell/download/setup.exe","rb").read(), mimetype='application/octet-stream')
    lResponse['Content-Disposition'] = 'attachment; filename=SriShell_setup.exe' 
    return lResponse<commit_msg>Added RequestContext to render<commit_after>'''
Created on Dec 30, 2010

@author: Sandeva Goonetilleke
'''

from django.http import HttpResponse

from django.shortcuts import render_to_response
from utils import getHtmlPath

import logging
from django.template.context import RequestContext

logger = logging.getLogger(__name__)

def index(request):
    return render_to_response(
         getHtmlPath(__name__,'base.html'), 
         context_instance=RequestContext(request))

def srishell_download(request):
    """
    Download file to browser
    """
    
    print "\r\n"*2
    print "O"*100

    print \
    """Content-Type:application/octet-stream
Content-Disposition:attachment; filename=SriShell_setup.exe
"""
    print open("templates/srishell/download/setup.exe",'rb').read()
    exit()
#    lFile = MyFile("templates/srishell/download/setup.exe", users.get_current_user())
    lResponse = HttpResponse(open("templates/srishell/download/setup.exe","rb").read(), mimetype='application/octet-stream')
    lResponse['Content-Disposition'] = 'attachment; filename=SriShell_setup.exe' 
    return lResponse
{'fraction_non_alphanumeric': 0.1272989542012261, 'fraction_numerical': 0.00721240533717995, 'mean_word_length': 4.194756554307116, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 23, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1576035', 'n_tokens_mistral': 870, 'n_tokens_neox': 833, 'n_words': 165}