[extensions-web] Rename user_has_access to user_can_edit



commit ed593f71c9fe289d40fb7f9ace503a1b77c7a459
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Nov 1 16:56:14 2011 -0400

    Rename user_has_access to user_can_edit
    
    It's a clearer name

 sweettooth/extensions/models.py |    2 +-
 sweettooth/extensions/views.py  |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/sweettooth/extensions/models.py b/sweettooth/extensions/models.py
index 46e8953..69b50b7 100644
--- a/sweettooth/extensions/models.py
+++ b/sweettooth/extensions/models.py
@@ -85,7 +85,7 @@ class Extension(models.Model):
             return qs[0]
         return None
 
-    def user_has_access(self, user):
+    def user_can_edit(self, user):
         if user == self.creator:
             return True
         if user.has_perm('extensions.can-modify-data'):
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index a1a5226..a6444a5 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -46,7 +46,7 @@ def extension_latest_version_view(request, obj, **kwargs):
         return redirect('extensions-detail', **kwargs)
 
     # If the user can edit the model, let him do so.
-    if extension.user_has_access(request.user):
+    if extension.user_can_edit(request.user):
         template_name = "extensions/detail_edit.html"
     else:
         template_name = "extensions/detail.html"
@@ -88,7 +88,7 @@ def extension_version_view(request, obj, **kwargs):
         return redirect('extensions-version-detail', **kwargs)
 
     # If the user can edit the model, let him do so.
-    if extension.user_has_access(request.user):
+    if extension.user_can_edit(request.user):
         template_name = "extensions/detail_edit.html"
     else:
         template_name = "extensions/detail.html"
@@ -108,7 +108,7 @@ def extension_version_view(request, obj, **kwargs):
 @post_only_view
 @model_view(models.ExtensionVersion)
 def ajax_submit_and_lock_view(request, obj):
-    if not obj.extension.user_has_access(request.user):
+    if not obj.extension.user_can_edit(request.user):
         return HttpResponseForbidden()
 
     if obj.status != models.STATUS_NEW:
@@ -123,7 +123,7 @@ def ajax_submit_and_lock_view(request, obj):
 @post_only_view
 @model_view(models.Extension)
 def ajax_inline_edit_view(request, obj):
-    if not obj.user_has_access(request.user):
+    if not obj.user_can_edit(request.user):
         return HttpResponseForbidden()
 
     key = request.POST['id']



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]