diff options
author | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2018-05-26 17:04:36 +0200 |
---|---|---|
committer | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2018-05-26 17:04:36 +0200 |
commit | 7e3f1bdc410a3b533a53dee97424fb108f8fc325 (patch) | |
tree | c03b87b85180cfefb8e0422eb07231f20818bb19 /cherrypy/process/plugins.py | |
parent | 94ef9cbf6ff7a184fd52ce20737d1ad2cf4d4384 (diff) | |
download | cherrypy-git-7e3f1bdc410a3b533a53dee97424fb108f8fc325.tar.gz |
Upgrade @property decorator syntax
Diffstat (limited to 'cherrypy/process/plugins.py')
-rw-r--r-- | cherrypy/process/plugins.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/cherrypy/process/plugins.py b/cherrypy/process/plugins.py index 4c2328e3..7b3fc7ee 100644 --- a/cherrypy/process/plugins.py +++ b/cherrypy/process/plugins.py @@ -233,9 +233,12 @@ class DropPrivileges(SimplePlugin): self.gid = gid self.umask = umask - def _get_uid(self): + @property + def uid(self): + """The uid under which to run. Availability: Unix.""" return self._uid + @uid.setter def _set_uid(self, val): if val is not None: if pwd is None: @@ -245,12 +248,13 @@ class DropPrivileges(SimplePlugin): elif isinstance(val, text_or_bytes): val = pwd.getpwnam(val)[2] self._uid = val - uid = property(_get_uid, _set_uid, - doc='The uid under which to run. Availability: Unix.') - def _get_gid(self): + @property + def gid(self): + """The gid under which to run. Availability: Unix.""" return self._gid + @gid.setter def _set_gid(self, val): if val is not None: if grp is None: @@ -260,12 +264,17 @@ class DropPrivileges(SimplePlugin): elif isinstance(val, text_or_bytes): val = grp.getgrnam(val)[2] self._gid = val - gid = property(_get_gid, _set_gid, - doc='The gid under which to run. Availability: Unix.') - def _get_umask(self): + @property + def umask(self): + """The default permission mode for newly created files and directories. + + Usually expressed in octal format, for example, ``0644``. + Availability: Unix, Windows. + """ return self._umask + @umask.setter def _set_umask(self, val): if val is not None: try: @@ -275,15 +284,6 @@ class DropPrivileges(SimplePlugin): level=30) val = None self._umask = val - umask = property( - _get_umask, - _set_umask, - doc="""The default permission mode for newly created files and - directories. - - Usually expressed in octal format, for example, ``0644``. - Availability: Unix, Windows. - """) def start(self): # uid/gid |