public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/webapp-config:master commit in: WebappConfig/
Date: Mon, 22 Apr 2013 00:52:26 +0000 (UTC)	[thread overview]
Message-ID: <1366591933.425869c93a66b23dd51a67a613c422d581500555.blueness@gentoo> (raw)

commit:     425869c93a66b23dd51a67a613c422d581500555
Author:     Vincent Brillault <gentoo <AT> lerya <DOT> net>
AuthorDate: Mon Apr 22 00:47:03 2013 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Apr 22 00:52:13 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit;h=425869c9

WebappConfig/{db,filetype,permissions}.py: code cleanup

1) Add a __str__ method on class PermissionMap for debugging.
2) Fix a wrong debug mesasge in WebappSource.
3) Replace __fix(i).strip() by __fix(i) in FileType since
__fix already strip the input.
4) Add missing cases in FileType comments

Thanks Devan Franchini <twitch153 <AT> hotmail.com> for testing.

X-Gentoo-Bug: 231482
X-Gentoo-Bug-URL: https://bugs.gentoo.org/231482
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

---
 WebappConfig/db.py          |    2 +-
 WebappConfig/filetype.py    |   22 ++++++++++++----------
 WebappConfig/permissions.py |    6 ++++++
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/WebappConfig/db.py b/WebappConfig/db.py
index 37223d0..78597bd 100644
--- a/WebappConfig/db.py
+++ b/WebappConfig/db.py
@@ -551,7 +551,7 @@ class WebappSource(AppHierarchy):
             flist = open(self.appdir() + '/' + server_owned)
             server_files = flist.readlines()
 
-            OUT.debug('Identified config-protected files.', 7)
+            OUT.debug('Identified server-owned files.', 7)
 
             flist.close()
 

diff --git a/WebappConfig/filetype.py b/WebappConfig/filetype.py
index aca8c59..3c5acbb 100644
--- a/WebappConfig/filetype.py
+++ b/WebappConfig/filetype.py
@@ -141,13 +141,13 @@ class FileType:
 
                 OUT.debug('Adding config-server-owned file', 8)
 
-                self.__cache[self.__fix(i).strip()] = 'config-server-owned'
+                self.__cache[self.__fix(i)] = 'config-server-owned'
 
             else:
 
                 OUT.debug('Adding server-owned file', 8)
 
-                self.__cache[self.__fix(i).strip()] = 'server-owned'
+                self.__cache[self.__fix(i)] = 'server-owned'
 
 
     def filetype(self, filename):
@@ -158,11 +158,12 @@ class FileType:
 
         returns one of these:
 
-          server-owned  - file needs to be owned by the webserver user
-                          (and needs to be a local copy)
-          config-owned  - file needs to be owned by the config user
-                          (and needs to be a local copy)
-          virtual       - we do not need a local copy of the file
+          server-owned         - file needs to be owned by the webserver user
+                                 (and needs to be a local copy)
+          config-owned         - file needs to be owned by the config user
+                                 (and needs to be a local copy)
+          config-server-owned  - Both the previous cases at the same time
+          virtual              - we do not need a local copy of the file
 
         NOTE:
           Use get_dirtype(directory) for directories
@@ -190,9 +191,10 @@ class FileType:
 
         returns one of these:
 
-          server-owned  - dir needs to be owned by the webserver user
-          config-owned  - dir needs to be owned by the config user
-          default-owned - we need a local copy, owned by root
+          server-owned         - dir needs to be owned by the webserver user
+          config-owned         - dir needs to be owned by the config user
+          config-server-owned  - Both the previous cases at the same time
+          default-owned        - we need a local copy, owned by root
 
         NOTE:
           Use get_filetype(filename) for files

diff --git a/WebappConfig/permissions.py b/WebappConfig/permissions.py
index f430316..ad65df1 100644
--- a/WebappConfig/permissions.py
+++ b/WebappConfig/permissions.py
@@ -179,6 +179,12 @@ class PermissionMap:
             self.__permissions = splitted_permissions
             self.__absolute    = False
 
+    def __str__(self):
+      if self.__absolute:
+        return 'Absolute: {}'.format(oct(self.__permissions))
+      else:
+        return 'Relative: {}'.format(self.__permissions)
+
 def get_group(group):
     '''
     Specify a group id either as integer, as string that can


             reply	other threads:[~2013-04-22  0:52 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-22  0:52 Anthony G. Basile [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-06-22 23:04 [gentoo-commits] proj/webapp-config:master commit in: WebappConfig/ Devan Franchini
2017-02-16  3:09 Devan Franchini
2017-02-16  3:09 Devan Franchini
2017-02-16  3:09 Devan Franchini
2017-02-16  3:09 Devan Franchini
2016-05-12 12:42 Anthony G. Basile
2015-07-11  1:27 Devan Franchini
2015-07-03  4:50 Devan Franchini
2015-07-02 16:49 Devan Franchini
2015-06-19 22:38 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2015-06-19 19:52 Devan Franchini
2014-01-25  3:17 Devan Franchini
2014-01-25  3:14 Devan Franchini
2014-01-25  3:14 Devan Franchini
2014-01-25  3:14 Devan Franchini
2014-01-25  3:14 Devan Franchini
2014-01-25  3:14 Devan Franchini
2014-01-25  3:14 Devan Franchini
2014-01-25  3:14 Devan Franchini
2014-01-25  3:14 Devan Franchini
2014-01-25  3:14 Devan Franchini
2014-01-25  3:14 Devan Franchini
2014-01-25  3:14 Devan Franchini
2014-01-02  1:47 Devan Franchini
2014-01-01  1:09 Devan Franchini
2013-10-29 19:13 Devan Franchini
2013-10-29  2:40 Devan Franchini
2013-10-29  2:40 Devan Franchini
2013-10-29  2:40 Devan Franchini
2013-10-29  2:40 Devan Franchini
2013-10-29  2:40 Devan Franchini
2013-10-29  2:18 Devan Franchini
2013-10-29  2:18 Devan Franchini
2013-10-29  2:15 Devan Franchini
2013-10-10  0:35 Devan Franchini
2013-09-26  4:03 Devan Franchini
2013-09-26  3:44 Devan Franchini
2013-09-24 18:20 Anthony G. Basile
2013-09-24 18:20 Anthony G. Basile
2013-09-24 18:20 Anthony G. Basile
2013-09-24 18:20 Anthony G. Basile
2013-08-06 12:28 Anthony G. Basile
2013-08-06 11:00 Anthony G. Basile
2013-08-06 11:00 Anthony G. Basile
2013-08-03 13:24 Anthony G. Basile
2013-08-03 13:24 Anthony G. Basile
2013-08-03 13:24 Anthony G. Basile
2013-03-23  4:05 Anthony G. Basile
2013-03-14  2:19 Anthony G. Basile
2013-03-09 13:45 Anthony G. Basile
2013-02-12  3:40 Anthony G. Basile
2012-06-29 13:00 Anthony G. Basile
2012-06-29 13:00 Anthony G. Basile
2012-06-29 13:00 Anthony G. Basile
2012-06-29 13:00 Anthony G. Basile
2012-06-29 13:00 Anthony G. Basile
2012-06-29 13:00 Anthony G. Basile
2012-06-29 13:00 Anthony G. Basile
2011-12-30 17:52 Anthony G. Basile
2011-12-30 17:50 Anthony G. Basile
2011-12-30 17:34 Anthony G. Basile
2011-12-30 17:23 Anthony G. Basile
2011-12-30 17:11 Anthony G. Basile
2011-12-30 16:50 Anthony G. Basile
2011-12-30 16:42 Anthony G. Basile
2011-08-06  1:51 Anthony G. Basile
2011-06-14 15:23 Anthony G. Basile

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1366591933.425869c93a66b23dd51a67a613c422d581500555.blueness@gentoo \
    --to=blueness@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox