[PATCH 13 of 15 cubicweb] [doc] doc8 replace tabs by four spaces

Arthur Lutz arthur.lutz at logilab.fr
Fri Jan 31 17:26:42 CET 2020


# HG changeset patch
# User Arthur Lutz <arthur.lutz at logilab.fr>
# Date 1580487226 -3600
#      Fri Jan 31 17:13:46 2020 +0100
# Node ID b78119980e1816f13ba4c61727a9e24dd2892740
# Parent  2603db42720a4607bfdc428492ba037c4ceef4c8
# EXP-Topic doc-cleanup
[doc] doc8 replace tabs by four spaces

diff --git a/doc/book/devrepo/datamodel/definition.rst b/doc/book/devrepo/datamodel/definition.rst
--- a/doc/book/devrepo/datamodel/definition.rst
+++ b/doc/book/devrepo/datamodel/definition.rst
@@ -466,7 +466,7 @@
     __permissions__ = {'read': ('managers', 'users'),
                        'add': ('managers', RRQLExpression('U has_update_permission S')),
                        'delete': ('managers', RRQLExpression('U has_update_permission S'))
-		       }
+               }
 
 In the above example, user will be allowed to add/delete `my_relation` if he has
 the `update` permission on the subject of the relation.
diff --git a/doc/book/devrepo/repo/hooks.rst b/doc/book/devrepo/repo/hooks.rst
--- a/doc/book/devrepo/repo/hooks.rst
+++ b/doc/book/devrepo/repo/hooks.rst
@@ -35,11 +35,11 @@
         events = ('before_add_entity', 'before_update_entity')
 
         def __call__(self):
-	    if 'age' in self.entity.cw_edited:
+        if 'age' in self.entity.cw_edited:
                 if 0 <= self.entity.age <= 120:
                    return
-		msg = self._cw._('age must be between 0 and 120')
-		raise ValidationError(self.entity.eid, {'age': msg})
+        msg = self._cw._('age must be between 0 and 120')
+        raise ValidationError(self.entity.eid, {'age': msg})
 
 In our example the base `__select__` is augmented with an `is_instance` selector
 matching the desired entity type.
diff --git a/doc/book/devrepo/vreg.rst b/doc/book/devrepo/vreg.rst
--- a/doc/book/devrepo/vreg.rst
+++ b/doc/book/devrepo/vreg.rst
@@ -300,18 +300,18 @@
 .. sourcecode:: python
 
     class UserLink(component.Component):
-	'''if the user is the anonymous user, build a link to login else a link
-	to the connected user object with a logout link
-	'''
-	__regid__ = 'loggeduserlink'
+    '''if the user is the anonymous user, build a link to login else a link
+    to the connected user object with a logout link
+    '''
+    __regid__ = 'loggeduserlink'
 
-	def call(self):
-	    if self._cw.session.anonymous_session:
-		# display login link
-		...
-	    else:
-		# display a link to the connected user object with a loggout link
-		...
+    def call(self):
+        if self._cw.session.anonymous_session:
+        # display login link
+        ...
+        else:
+        # display a link to the connected user object with a loggout link
+        ...
 
 The proper way to implement this with |cubicweb| is two have two different
 classes sharing the same identifier but with different selectors so you'll get
@@ -320,21 +320,21 @@
 .. sourcecode:: python
 
     class UserLink(component.Component):
-	'''display a link to the connected user object with a loggout link'''
-	__regid__ = 'loggeduserlink'
-	__select__ = component.Component.__select__ & authenticated_user()
+    '''display a link to the connected user object with a loggout link'''
+    __regid__ = 'loggeduserlink'
+    __select__ = component.Component.__select__ & authenticated_user()
 
-	def call(self):
+    def call(self):
             # display useractions and siteactions
-	    ...
+        ...
 
     class AnonUserLink(component.Component):
-	'''build a link to login'''
-	__regid__ = 'loggeduserlink'
-	__select__ = component.Component.__select__ & anonymous_user()
+    '''build a link to login'''
+    __regid__ = 'loggeduserlink'
+    __select__ = component.Component.__select__ & anonymous_user()
 
-	def call(self):
-	    # display login link
+    def call(self):
+        # display login link
             ...
 
 The big advantage, aside readability once you're familiar with the
diff --git a/doc/book/devweb/edition/examples.rst b/doc/book/devweb/edition/examples.rst
--- a/doc/book/devweb/edition/examples.rst
+++ b/doc/book/devweb/edition/examples.rst
@@ -56,42 +56,42 @@
 .. sourcecode:: python
 
     def sender_value(form, field):
-	return '%s <%s>' % (form._cw.user.dc_title(), form._cw.user.get_email())
+    return '%s <%s>' % (form._cw.user.dc_title(), form._cw.user.get_email())
 
     def recipient_choices(form, field):
-	return [(e.get_email(), e.eid)
+    return [(e.get_email(), e.eid)
                  for e in form.cw_rset.entities()
-		 if e.get_email()]
+         if e.get_email()]
 
     def recipient_value(form, field):
-	return [e.eid for e in form.cw_rset.entities()
+    return [e.eid for e in form.cw_rset.entities()
                 if e.get_email()]
 
     class MassMailingForm(forms.FieldsForm):
-	__regid__ = 'massmailing'
+    __regid__ = 'massmailing'
 
-	needs_js = ('cubicweb.widgets.js',)
-	domid = 'sendmail'
-	action = 'sendmail'
+    needs_js = ('cubicweb.widgets.js',)
+    domid = 'sendmail'
+    action = 'sendmail'
 
-	sender = ff.StringField(widget=TextInput({'disabled': 'disabled'}),
-				label=_('From:'),
-				value=sender_value)
+    sender = ff.StringField(widget=TextInput({'disabled': 'disabled'}),
+                label=_('From:'),
+                value=sender_value)
 
-	recipient = ff.StringField(widget=CheckBox(),
-	                           label=_('Recipients:'),
-				   choices=recipient_choices,
-				   value=recipients_value)
+    recipient = ff.StringField(widget=CheckBox(),
+                               label=_('Recipients:'),
+                   choices=recipient_choices,
+                   value=recipients_value)
 
-	subject = ff.StringField(label=_('Subject:'), max_length=256)
+    subject = ff.StringField(label=_('Subject:'), max_length=256)
 
-	mailbody = ff.StringField(widget=AjaxWidget(wdgtype='TemplateTextField',
-						    inputid='mailbody'))
+    mailbody = ff.StringField(widget=AjaxWidget(wdgtype='TemplateTextField',
+                            inputid='mailbody'))
 
-	form_buttons = [ImgButton('sendbutton', "javascript: $('#sendmail').submit()",
-				  _('send email'), 'SEND_EMAIL_ICON'),
-			ImgButton('cancelbutton', "javascript: history.back()",
-				  stdmsgs.BUTTON_CANCEL, 'CANCEL_EMAIL_ICON')]
+    form_buttons = [ImgButton('sendbutton', "javascript: $('#sendmail').submit()",
+                  _('send email'), 'SEND_EMAIL_ICON'),
+            ImgButton('cancelbutton', "javascript: history.back()",
+                  stdmsgs.BUTTON_CANCEL, 'CANCEL_EMAIL_ICON')]
 
 Let's detail what's going on up there. Our form will hold four fields:
 
@@ -125,13 +125,13 @@
 .. sourcecode:: python
 
     class MassMailingFormView(form.FormViewMixIn, EntityView):
-	__regid__ = 'massmailing'
-	__select__ = is_instance(IEmailable) & authenticated_user()
+    __regid__ = 'massmailing'
+    __select__ = is_instance(IEmailable) & authenticated_user()
 
-	def call(self):
-	    form = self._cw.vreg['forms'].select('massmailing', self._cw,
-	                                         rset=self.cw_rset)
-	    form.render(w=self.w)
+    def call(self):
+        form = self._cw.vreg['forms'].select('massmailing', self._cw,
+                                             rset=self.cw_rset)
+        form.render(w=self.w)
 
 As you see, we simply define a view with proper selector so it only apply to a
 result set containing :class:`IEmailable` entities, and so that only users in the
diff --git a/doc/book/devweb/js.rst b/doc/book/devweb/js.rst
--- a/doc/book/devweb/js.rst
+++ b/doc/book/devweb/js.rst
@@ -142,7 +142,7 @@
     function removeBookmark(beid) {
         d = asyncRemoteExec('delete_bookmark', beid);
         d.addCallback(function(boxcontent) {
-	    reloadComponent('bookmarks_box', '', 'boxes', 'bookmarks_box');
+        reloadComponent('bookmarks_box', '', 'boxes', 'bookmarks_box');
             document.location.hash = '#header';
             updateMessage(_("bookmark has been removed"));
          });
diff --git a/doc/book/devweb/views/reledit.rst b/doc/book/devweb/views/reledit.rst
--- a/doc/book/devweb/views/reledit.rst
+++ b/doc/book/devweb/views/reledit.rst
@@ -136,14 +136,14 @@
     from cubicweb.web.views import reledit
 
     class DeactivatedAutoClickAndEditFormView(reledit.AutoClickAndEditFormView):
-	def _should_edit_attribute(self, rschema):
-	    return False
+    def _should_edit_attribute(self, rschema):
+        return False
 
-	def _should_edit_attribute(self, rschema, role):
-	    return False
+    def _should_edit_attribute(self, rschema, role):
+        return False
 
     def registration_callback(vreg):
-	vreg.register_and_replace(DeactivatedAutoClickAndEditFormView,
-				  reledit.AutoClickAndEditFormView)
+    vreg.register_and_replace(DeactivatedAutoClickAndEditFormView,
+                  reledit.AutoClickAndEditFormView)
 
 
diff --git a/doc/tutorials/advanced/part02_security.rst b/doc/tutorials/advanced/part02_security.rst
--- a/doc/tutorials/advanced/part02_security.rst
+++ b/doc/tutorials/advanced/part02_security.rst
@@ -117,25 +117,25 @@
     from cubicweb.schema import ERQLExpression
 
     VISIBILITY_PERMISSIONS = {
-	'read':   ('managers',
-		   ERQLExpression('X visibility "public"'),
-		   ERQLExpression('X may_be_read_by U')),
-	'add':    ('managers',),
-	'update': ('managers', 'owners',),
-	'delete': ('managers', 'owners'),
-	}
+    'read':   ('managers',
+           ERQLExpression('X visibility "public"'),
+           ERQLExpression('X may_be_read_by U')),
+    'add':    ('managers',),
+    'update': ('managers', 'owners',),
+    'delete': ('managers', 'owners'),
+    }
     AUTH_ONLY_PERMISSIONS = {
-	    'read':   ('managers', 'users'),
-	    'add':    ('managers',),
-	    'update': ('managers', 'owners',),
-	    'delete': ('managers', 'owners'),
-	    }
+        'read':   ('managers', 'users'),
+        'add':    ('managers',),
+        'update': ('managers', 'owners',),
+        'delete': ('managers', 'owners'),
+        }
     CLASSIFIERS_PERMISSIONS = {
-	    'read':   ('managers', 'users', 'guests'),
-	    'add':    ('managers',),
-	    'update': ('managers', 'owners',),
-	    'delete': ('managers', 'owners'),
-	    }
+        'read':   ('managers', 'users', 'guests'),
+        'add':    ('managers',),
+        'update': ('managers', 'owners',),
+        'delete': ('managers', 'owners'),
+        }
 
     from cubicweb_folder.schema import Folder
     from cubicweb_file.schema import File



More information about the cubicweb-devel mailing list