Lines 23-28
Link Here
|
23 |
import re, os, os.path |
23 |
import re, os, os.path |
24 |
|
24 |
|
25 |
import WebappConfig.wrapper |
25 |
import WebappConfig.wrapper |
|
|
26 |
from WebappConfig.config import Config |
26 |
|
27 |
|
27 |
from WebappConfig.debug import OUT |
28 |
from WebappConfig.debug import OUT |
28 |
|
29 |
|
Lines 35-46
class Protection:
Link Here
|
35 |
A small helper class to handle config protection. |
36 |
A small helper class to handle config protection. |
36 |
''' |
37 |
''' |
37 |
|
38 |
|
38 |
def __init__(self, cat, pn, pvr, pm): |
39 |
def __init__(self, config, cat, pn, pvr, pm): |
39 |
''' |
40 |
''' |
40 |
This is distribution specific so the information is provided by |
41 |
This is distribution specific so the information is provided by |
41 |
wrapper.py |
42 |
wrapper.py |
42 |
''' |
43 |
''' |
43 |
self.config_protect = WebappConfig.wrapper.config_protect(cat, pn, pvr, pm) |
44 |
self.config = config |
|
|
45 |
self.config_protect = WebappConfig.wrapper.config_protect(self.config, cat, pn, pvr, pm) |
44 |
self.protect_prefix = WebappConfig.wrapper.protect_prefix |
46 |
self.protect_prefix = WebappConfig.wrapper.protect_prefix |
45 |
self.update_command = WebappConfig.wrapper.update_command |
47 |
self.update_command = WebappConfig.wrapper.update_command |
46 |
|
48 |
|
Lines 70-76
class Protection:
Link Here
|
70 |
>>> import os.path |
72 |
>>> import os.path |
71 |
>>> here = os.path.dirname(os.path.realpath(__file__)) |
73 |
>>> here = os.path.dirname(os.path.realpath(__file__)) |
72 |
|
74 |
|
73 |
>>> a = Protection('','horde','3.0.5','portage') |
75 |
>>> import WebappConfig |
|
|
76 |
>>> config = WebappConfig.config.Config() |
77 |
>>> a = Protection(config,'','horde','3.0.5','portage') |
74 |
>>> a.get_protectedname(here + '/tests/testfiles/protect/empty', |
78 |
>>> a.get_protectedname(here + '/tests/testfiles/protect/empty', |
75 |
... 'test')#doctest: +ELLIPSIS |
79 |
... 'test')#doctest: +ELLIPSIS |
76 |
'.../tests/testfiles/protect/empty//._cfg0000_test' |
80 |
'.../tests/testfiles/protect/empty//._cfg0000_test' |
Lines 117-124
class Protection:
Link Here
|
117 |
Traverses the path of parent directories for the |
121 |
Traverses the path of parent directories for the |
118 |
given install dir and checks if any matches the list |
122 |
given install dir and checks if any matches the list |
119 |
of config protected files. |
123 |
of config protected files. |
120 |
|
124 |
|
121 |
>>> a = Protection('','horde','3.0.5','portage') |
125 |
>>> import WebappConfig |
|
|
126 |
>>> config = WebappConfig.config.Config() |
127 |
>>> a = Protection(config,'','horde','3.0.5','portage') |
122 |
|
128 |
|
123 |
Add a virtual config protected directory: |
129 |
Add a virtual config protected directory: |
124 |
|
130 |
|
Lines 177-184
class Protection:
Link Here
|
177 |
''' |
183 |
''' |
178 |
Instruct the user how to update the application. |
184 |
Instruct the user how to update the application. |
179 |
|
185 |
|
|
|
186 |
>>> import WebappConfig |
187 |
>>> config = WebappConfig.config.Config() |
180 |
>>> OUT.color_off() |
188 |
>>> OUT.color_off() |
181 |
>>> a = Protection('','horde','3.0.5','portage') |
189 |
>>> a = Protection(config, '','horde','3.0.5','portage') |
182 |
|
190 |
|
183 |
>>> a.how_to_update(['/my/strange/htdocs/where/i/installed/x']) |
191 |
>>> a.how_to_update(['/my/strange/htdocs/where/i/installed/x']) |
184 |
* One or more files have been config protected |
192 |
* One or more files have been config protected |