Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: svn://cherokee-project.com/cherokee/trunk@1415 5dc97367-9…
…7f1-0310-9951-d761b3857238
- Loading branch information
Showing
135 changed files
with
565 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from Form import * | ||
from Table import * | ||
from Module import * | ||
|
||
class ModuleDefault (Module, FormHelper): | ||
validation = [] | ||
|
||
def __init__ (self, cfg, prefix, submit_url): | ||
Module.__init__ (self, 'default', cfg, prefix, submit_url) | ||
FormHelper.__init__ (self, 'default', cfg) | ||
|
||
def _op_render (self): | ||
return "" | ||
|
||
def apply_cfg (self, values): | ||
None | ||
|
||
def get_name (self): | ||
return self._id.capitalize() | ||
|
||
def get_type_name (self): | ||
return self._id.capitalize() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from Form import * | ||
from Table import * | ||
from Module import * | ||
import validations | ||
|
||
NOTE_DIRECTORY = "Public Web Directory to which content the configuration will be applied." | ||
|
||
class ModuleDirectory (Module, FormHelper): | ||
validation = [('tmp!new_rule!value', validations.is_dir_formated)] | ||
|
||
def __init__ (self, cfg, prefix, submit_url): | ||
Module.__init__ (self, 'directory', cfg, prefix, submit_url) | ||
FormHelper.__init__ (self, 'directory', cfg) | ||
|
||
def _op_render (self): | ||
table = TableProps() | ||
if self._prefix.startswith('tmp!'): | ||
self.AddPropEntry (table, 'Web Directory', '%s!value'%(self._prefix), NOTE_DIRECTORY) | ||
else: | ||
self.AddPropEntry (table, 'Web Directory', '%s!directory'%(self._prefix), NOTE_DIRECTORY) | ||
return str(table) | ||
|
||
def apply_cfg (self, values): | ||
if values.has_key('value'): | ||
dir_name = values['value'] | ||
self._cfg['%s!match!directory'%(self._prefix)] = dir_name | ||
|
||
def get_name (self): | ||
return self._cfg.get_val ('%s!match!directory'%(self._prefix)) | ||
|
||
def get_type_name (self): | ||
return self._id.capitalize() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from Form import * | ||
from Table import * | ||
from Module import * | ||
import validations | ||
|
||
NOTE_EXTENSIONS = "File extension list to which content the configuration will be applied." | ||
|
||
class ModuleExtensions (Module, FormHelper): | ||
validation = [('tmp!new_rule!value', validations.is_safe_id_list)] | ||
|
||
def __init__ (self, cfg, prefix, submit_url): | ||
Module.__init__ (self, 'extensions', cfg, prefix, submit_url) | ||
FormHelper.__init__ (self, 'extensions', cfg) | ||
|
||
def _op_render (self): | ||
table = TableProps() | ||
if self._prefix.startswith('tmp!'): | ||
self.AddPropEntry (table, 'Extensions', '%s!value'%(self._prefix), NOTE_EXTENSIONS) | ||
else: | ||
self.AddPropEntry (table, 'Extensions', '%s!extensions'%(self._prefix), NOTE_EXTENSIONS) | ||
return str(table) | ||
|
||
def _op_apply_changes (self, uri, post): | ||
self.ApplyChangesPrefix (self._prefix, None, post) | ||
|
||
def apply_cfg (self, values): | ||
if not values.has_key('value'): | ||
print "ERROR, a 'value' entry is needed!" | ||
|
||
exts = values['value'] | ||
self._cfg['%s!match!extensions'%(self._prefix)] = exts | ||
|
||
def get_name (self): | ||
return self._cfg.get_val ('%s!match!extensions'%(self._prefix)) | ||
|
||
def get_type_name (self): | ||
return self._id.capitalize() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from Form import * | ||
from Table import * | ||
from Module import * | ||
import validations | ||
|
||
NOTE_HEADER = "Header against which the regular expression will be evaluated." | ||
NOTE_MATCH = "Regular expression." | ||
|
||
LENGHT_LIMIT = 10 | ||
|
||
HEADERS = [ | ||
('Accept-Encoding', 'Accept-Encoding'), | ||
('Accept-Charset', 'Accept-Charset'), | ||
('Accept-Language', 'Accept-Language'), | ||
('Referer', 'Referer'), | ||
('User-Agent', 'User-Agent') | ||
] | ||
|
||
class ModuleHeader (Module, FormHelper): | ||
validation = [('tmp!new_rule!value', validations.is_dir_formated)] | ||
|
||
def __init__ (self, cfg, prefix, submit_url): | ||
Module.__init__ (self, 'header', cfg, prefix, submit_url) | ||
FormHelper.__init__ (self, 'header', cfg) | ||
|
||
def _op_render (self): | ||
table = TableProps() | ||
if self._prefix.startswith('tmp!'): | ||
self.AddPropOptions (table, 'Header', '%s!value'%(self._prefix), HEADERS, NOTE_HEADER) | ||
else: | ||
self.AddPropOptions (table, 'Header', '%s!header'%(self._prefix), HEADERS, NOTE_HEADER) | ||
self.AddPropEntry (table, 'Regular Expression', '%s!match'%(self._prefix), NOTE_MATCH) | ||
return str(table) | ||
|
||
def apply_cfg (self, values): | ||
if values.has_key('value'): | ||
header = values['value'] | ||
self._cfg['%s!match!header'%(self._prefix)] = header | ||
|
||
if values.has_key('match'): | ||
match = values['match'] | ||
self._cfg['%s!match!match'%(self._prefix)] = match | ||
|
||
def get_name (self): | ||
header = self._cfg.get_val ('%s!match!header'%(self._prefix)) | ||
if not header: | ||
return '' | ||
|
||
tmp = self._cfg.get_val ('%s!match!match'%(self._prefix), '') | ||
if len(tmp) > LENGHT_LIMIT: | ||
return "%s (%s..)" % (header, tmp[:5]) | ||
|
||
return "%s (%s)" % (header, tmp) | ||
|
||
def get_type_name (self): | ||
return self._id.capitalize() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.