Ñò
m–Ec           @   s*   d  d k  l Z d e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   transactiont   TransactionMiddlewarec           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s"  
    Transaction middleware. If this is enabled, each view function will be run
    with commit_on_response activated - that way a save() doesn't do a direct
    commit, the commit is done when a successful response is created. If an
    exception happens, the database is rolled back.
    c         C   s   t  i ƒ  t  i t ƒ d S(   s   Enters transaction managementN(   R    t   enter_transaction_managementt   managedt   True(   t   selft   request(    (    sG   /usr/local/lib/python2.6/dist-packages/django/middleware/transaction.pyt   process_request
   s    
c         C   s)   t  i ƒ  o t  i ƒ  n t  i ƒ  d S(   s9   Rolls back the database and leaves transaction managementN(   R    t   is_dirtyt   rollbackt   leave_transaction_management(   R   R   t	   exception(    (    sG   /usr/local/lib/python2.6/dist-packages/django/middleware/transaction.pyt   process_exception   s    c         C   s:   t  i ƒ  o) t  i ƒ  o t  i ƒ  n t  i ƒ  n | S(   s*   Commits and leaves transaction management.(   R    t
   is_managedR   t   commitR
   (   R   R   t   response(    (    sG   /usr/local/lib/python2.6/dist-packages/django/middleware/transaction.pyt   process_response   s
    (   t   __name__t
   __module__t   __doc__R   R   R   (    (    (    sG   /usr/local/lib/python2.6/dist-packages/django/middleware/transaction.pyR      s   		N(   t	   django.dbR    t   objectR   (    (    (    sG   /usr/local/lib/python2.6/dist-packages/django/middleware/transaction.pyt   <module>   s   