
%Rc           @   s   d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d  d l m	 Z	 d  d l
 m Z d  d l Z d   Z d	   Z d
   Z e d    Z d S(   i(   t   get_template(   t   Context(   t   HttpResponse(   t   render(   t   escape(   t   csrf_exemptNc         C   s   t  |  d  S(   Ns
   index.html(   R   (   t   request(    (    sP   /vol/project/2012/wmproject2013/WMProject/Crawler/django-server/crawler/views.pyt   index   s    c         C   s   d |  j  k r |  j  d r |  j  d } yB | d k rO t |  d i | d 6 St |  | d i | d 6 SWq d } t |  SXn  t d  S(   Nt   unamet   roots   report.htmlt	   user_names   .htmlsq   
									Either the username is invalid or this user doens't	
									have any page with broken links
									t   Empty(   t   GETR   R   (   R   t   usernamet   response(    (    sP   /vol/project/2012/wmproject2013/WMProject/Crawler/django-server/crawler/views.pyt   display_page   s    c      	   C   s  d |  j  k r
|  j  d r
d |  j  k r
|  j  d r
d |  j  k r
|  j  d r
|  j  d } |  j  d } |  j  d } d | GH| j d  r | d  } n  x0 | j d  d k r | | j d  d } q Wy t |  | d | d  SWq
d	 } t |  SXn  t d
  S(   Nt   urlR   t   locations   fname : t   /ii   s   .htmls   The feature you asked for is not working for this page.
 
							Please contact doc-wmproject2013_u@imperial.ac.uk.

							We will try fix it as soon as possible.					
					R   (   R   t   endswitht   findR   R   (   R   t   fnameR   R   R   (    (    sP   /vol/project/2012/wmproject2013/WMProject/Crawler/django-server/crawler/views.pyt	   mock_page%   s     +)	c         C   sm   |  j  d k rc y: |  j d } |  j d } t j | |  } t |  SWqc d } t |  SXn  t d  S(   Nt   POSTR   t   pointerss    The feature you asked for is not working for this page.
 
							Please contact doc-wmproject2013_u@imperial.ac.uk.

							We will try fix it as soon as possible.s   No source code to display!(   t   methodR   t	   functionst   get_code_to_displayR   (   R   R   t   pointer_to_anchort   codeR   (    (    sP   /vol/project/2012/wmproject2013/WMProject/Crawler/django-server/crawler/views.pyt
   see_source@   s    (   t   django.template.loaderR    t   django.templateR   t   django.httpR   t   django.shortcutsR   t   django.utils.htmlR   t   django.views.decorators.csrfR   R   R   R   R   R   (    (    (    sP   /vol/project/2012/wmproject2013/WMProject/Crawler/django-server/crawler/views.pyt   <module>   s   
			