[PATCH 7 of 8 cubicweb] [doc] Fix bugs in code examples

Nicola Spanti nicola.spanti at logilab.fr
Wed Mar 18 17:09:51 CET 2020


Adding b before the string did not work? I don't know the bytes function 
used in the patch and it seems strange to need something like this. If 
it is, I would be curious to know the explanation.
https://docs.python.org/3/library/stdtypes.html#bytes

Note: I published the next patch. Thanks.

Le 18/03/2020 à 14:39, Elodie Thieblin a écrit :
> # HG changeset patch
> # User Elodie Thieblin <ethieblin at logilab.fr>
> # Date 1584527405 -3600
> #      Wed Mar 18 11:30:05 2020 +0100
> # Node ID ece6ced08b483209f5b7a591182219f96704cb81
> # Parent  bd158294296cac9513fbdce1101087889f85b3ab
> # Available At ssh://hg@hg.logilab.org/review/cubicweb
> #              hg pull ssh://hg@hg.logilab.org/review/cubicweb -r ece6ced08b48
> # EXP-Topic doc_tuto
> [doc] Fix bugs in code examples
> 
> 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
> @@ -174,7 +174,7 @@ What's important in there:
>   Step 2: security propagation in hooks
>   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   
> -To fullfill the requirements, we have to implement::
> +To fullfill the requirements defined earlier, we have to implement:
>   
>     Also, unless explicity specified, visibility of an image should be the same as
>     its parent folder, as well as visibility of a comment should be the same as the
> @@ -348,7 +348,7 @@ model, in :file:`test/test_sytweb.py`:
>                                              visibility=u'restricted')
>                   photo1 = cnx.create_entity('File',
>                                              data_name=u'photo1.jpg',
> -                                           data=Binary('xxx'),
> +                                           data=Binary(bytes()),
>                                              filed_under=folder)
>   
>                   cnx.commit()
> @@ -359,7 +359,7 @@ model, in :file:`test/test_sytweb.py`:
>                   # unless explicitly specified
>                   photo2 = cnx.create_entity('File',
>                                              data_name=u'photo2.jpg',
> -                                           data=Binary('xxx'),
> +                                           data=Binary(bytes()),
>                                              visibility=u'public',
>                                              filed_under=folder)
>   
> diff --git a/doc/tutorials/advanced/part03_bfss.rst b/doc/tutorials/advanced/part03_bfss.rst
> --- a/doc/tutorials/advanced/part03_bfss.rst
> +++ b/doc/tutorials/advanced/part03_bfss.rst
> @@ -31,7 +31,7 @@ in :file:`cubicweb_sytweb/hooks.py` :
>               bfssdir = join(self.repo.config.appdatahome, 'bfss')
>               if not exists(bfssdir):
>                   makedirs(bfssdir)
> -                print 'created', bfssdir
> +                print ('created', bfssdir)
>               storage = storages.BytesFileSystemStorage(bfssdir)
>               storages.set_attribute_storage(self.repo, 'File', 'data', storage)
>   
> 



More information about the cubicweb-devel mailing list