.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.preferences.Setting Class Reference
+ Inheritance diagram for searx.preferences.Setting:

Public Member Functions

 __init__ (self, default_value, bool locked=False)
 
 parse (self, str data)
 
 get_value (self)
 
 save (self, str name, flask.Response resp)
 

Public Attributes

 value = default_value
 
 locked = locked
 

Detailed Description

Base class of user settings

Definition at line 44 of file preferences.py.

Constructor & Destructor Documentation

◆ __init__()

searx.preferences.Setting.__init__ ( self,
default_value,
bool locked = False )

Reimplemented in searx.preferences.EnumStringSetting, searx.preferences.MapSetting, searx.preferences.MultipleChoiceSetting, and searx.preferences.SetSetting.

Definition at line 47 of file preferences.py.

47 def __init__(self, default_value, locked: bool = False):
48 super().__init__()
49 self.value = default_value
50 self.locked = locked
51

References searx.preferences.Setting.__init__().

Referenced by searx.preferences.Setting.__init__().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ get_value()

searx.preferences.Setting.get_value ( self)
Returns the value of the setting

If needed, its overwritten in the inheritance.

Reimplemented in searx.preferences.SetSetting.

Definition at line 59 of file preferences.py.

59 def get_value(self):
60 """Returns the value of the setting
61
62 If needed, its overwritten in the inheritance.
63 """
64 return self.value
65

References searx.preferences.BooleanSetting.value, searx.preferences.EnumStringSetting.value, searx.preferences.MapSetting.value, searx.preferences.MultipleChoiceSetting.value, searx.preferences.SearchLanguageSetting.value, and searx.preferences.Setting.value.

◆ parse()

searx.preferences.Setting.parse ( self,
str data )
Parse ``data`` and store the result at ``self.value``

If needed, its overwritten in the inheritance.

Reimplemented in searx.preferences.BooleanSetting, searx.preferences.EnumStringSetting, searx.preferences.MapSetting, searx.preferences.MultipleChoiceSetting, searx.preferences.SearchLanguageSetting, and searx.preferences.SetSetting.

Definition at line 52 of file preferences.py.

52 def parse(self, data: str):
53 """Parse ``data`` and store the result at ``self.value``
54
55 If needed, its overwritten in the inheritance.
56 """
57 self.value = data
58

References searx.preferences.BooleanSetting.value, searx.preferences.EnumStringSetting.value, searx.preferences.MapSetting.value, searx.preferences.MultipleChoiceSetting.value, searx.preferences.SearchLanguageSetting.value, and searx.preferences.Setting.value.

◆ save()

searx.preferences.Setting.save ( self,
str name,
flask.Response resp )
Save cookie ``name`` in the HTTP response object

If needed, its overwritten in the inheritance.

Reimplemented in searx.preferences.BooleanSetting, searx.preferences.MapSetting, searx.preferences.MultipleChoiceSetting, and searx.preferences.SetSetting.

Definition at line 66 of file preferences.py.

66 def save(self, name: str, resp: flask.Response):
67 """Save cookie ``name`` in the HTTP response object
68
69 If needed, its overwritten in the inheritance."""
70 resp.set_cookie(name, self.value, max_age=COOKIE_MAX_AGE)
71
72

References searx.preferences.BooleanSetting.value, searx.preferences.EnumStringSetting.value, searx.preferences.MapSetting.value, searx.preferences.MultipleChoiceSetting.value, searx.preferences.SearchLanguageSetting.value, and searx.preferences.Setting.value.

Member Data Documentation

◆ locked

searx.preferences.Setting.locked = locked

Definition at line 50 of file preferences.py.

Referenced by searx.preferences.BooleanChoices.parse_form().

◆ value


The documentation for this class was generated from the following file: