Commits

Daniel Greenfeld committed e48f919

PEP-8 fun and tiny docs cleanup

Comments (0)

Files changed (2)

 .. django-visitor documentation master file, created by
    sphinx-quickstart on Tue Jul 26 07:25:04 2011.
-   You can adapt this file completely to your liking, but it should at least
-   contain the root `toctree` directive.
 
 Welcome to django-visitor's documentation!
 ==========================================
 
 Django 1.1 or newer
 
+Code Repo
+---------
+
+ * https://bitbucket.org/kencochrane/django-visitor
 
 Installation
 ------------

visitor/visitor_utils.py

 COOKIE_DOMAIN = getattr(settings, 'COOKIE_DOMAIN', None) # local domain only 
 COOKIE_MAX_AGE = getattr(settings, 'COOKIE_MAX_AGE', 31536000) # 1 year
 
-#-------------------------------------------------------------------------------
 def create_uuid(*parts):
     name = '-'.join([str(counter())] + [str(time.time())] + [str(p) for p in parts])
     return str(uuid.uuid5(uuid.NAMESPACE_URL, name))
-    
-#-------------------------------------------------------------------------------
+
 def ip_address_from_request(request):
     meta = request.META
 
         ip_address = meta.get('REMOTE_ADDR', None)
 
     return ip_address
-    
-#-------------------------------------------------------------------------------
+
 def get_visitor(visitor_key):
     """ get the visitor using the visitor key """
     return Visitor.objects.find_visitor(visitor_key)
 
-#-------------------------------------------------------------------------------
 def create_visitor(ip_address,session_key):
     """ Create the visitor given an ip_address """
     visitor = Visitor()
     visitor.save()
     return visitor
 
-#-------------------------------------------------------------------------------
 def update_visitor(visitor_key,session_key=None):
     """ update the visitor using the visitor key """
     visitor = Visitor.objects.find_visitor(visitor_key)
         visitor.save()
     return visitor
 
-
-#-------------------------------------------------------------------------------
 def get_visitor_cookie_key(request):
     """ look for the cookie and if we find one return the visitor key """
     if constants.COOKIE_VISITOR_KEY in request.COOKIES:
         return request.COOKIES[constants.COOKIE_VISITOR_KEY]
     else:
         return None
-        
-#-------------------------------------------------------------------------------
+
 def get_visitor_from_request(request):
     """ look for the cookie and if we find one return the visitor key """
     if constants.COOKIE_VISITOR_KEY in request.COOKIES:
         return get_visitor(request.COOKIES[constants.COOKIE_VISITOR_KEY])
     else:
         return None
-
-
-#-------------------------------------------------------------------------------
 def set_visitor_cookie(response, visitor):
     """ set the visitor cookie using the visitor object """
     if response and visitor and visitor.visitor_key:
             domain=COOKIE_DOMAIN
         )
 
-#-------------------------------------------------------------------------------
 def set_visitor_cookie_from_key(response, visitor_key):
     """ set the cookie using the visitor_key"""
     if response and visitor_key:
             domain=COOKIE_DOMAIN
         )
 
-#-------------------------------------------------------------------------------
 def delete_visitor_cookie(response):
     """ delete the visitor cookie """
     if response:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.