This file is indexed.

/usr/share/pyshared/sprox/widgets/widgets.py is in python-sprox 0.6.4-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
from tw.api import Widget
from tw.forms import CalendarDatePicker, CalendarDateTimePicker, TableForm, DataGrid
from tw.forms.fields import SingleSelectField, MultipleSelectField, InputField, HiddenField
from formencode.schema import Schema
from formencode.validators import StringBool
from formencode import Invalid
import inspect


class SproxMethodPutHiddenField(HiddenField):
    template="genshi:sprox.widgets.templates.hidden_put"

class SproxCalendarDatePicker(CalendarDatePicker):
    date_format = '%Y-%m-%d'

class SproxTimePicker(CalendarDateTimePicker):
    date_format = '%H:%M:%S'

class SproxCalendarDateTimePicker(CalendarDateTimePicker):
    date_format = '%Y-%m-%d %H:%M:%S'

class SproxDataGrid(DataGrid):
    template = "genshi:sprox.widgets.templates.datagrid"
    params = ['pks', 'controller', 'xml_fields']
    xml_fields = ['actions']

class ContainerWidget(Widget):
    template = "genshi:sprox.widgets.templates.container"
    params = ["controller",]

class TableLabelWidget(Widget):
    template = "genshi:sprox.widgets.templates.tableLabel"
    params = ["identifier", "controller"]

class ModelLabelWidget(Widget):
    template = "genshi:sprox.widgets.templates.modelLabel"
    params = ["identifier", "controller"]

class EntityLabelWidget(Widget):
    template = "genshi:sprox.widgets.templates.entityLabel"
    params = ["entity", "controller"]

class RecordViewWidget(Widget):
    template = "genshi:sprox.widgets.templates.recordViewTable"
    params = ["entity"]

class RecordFieldWidget(Widget):
    template = "genshi:sprox.widgets.templates.recordField"
    params = ['field_name']

class TableDefWidget(Widget):
    template = "genshi:sprox.widgets.templates.tableDef"
    params = ["identifier"]

class EntityDefWidget(Widget):
    available_engines = ['genshi']
    template = "sprox.widgets.templates.entityDef"
    params = ["entity"]

class TableWidget(Widget):
    available_engines = ['genshi']
    template = "genshi:sprox.widgets.templates.table"

class SproxTableForm(TableForm):
    available_engines = ['genshi']
    validator = Schema(ignore_missing_keys=True, allow_extra_fields=True)
    template = "genshi:sprox.widgets.templates.tableForm"

#custom checkbox widget since I am not happy with the behavior of the TW one
class SproxCheckBox(InputField):
    available_engines = ['genshi']
    template = "sprox.widgets.templates.checkbox"
    validator = StringBool
    def update_params(self, d):
        InputField.update_params(self, d)
        try:
            checked = self.validator.to_python(d.value)
        except Invalid:
            checked = False
        d.attrs['checked'] = checked or None

class PropertyMixin(Widget):
    params = ['entity', 'field_name', 'provider', 'dropdown_field_names']

    def _my_update_params(self, d, nullable=False):
        entity = self.entity
        options = self.provider.get_dropdown_options(self.entity, self.field_name, self.dropdown_field_names)
        if nullable:
            options.append([None,"-----------"])
        if len(options) == 0:
            return {}
        d['options']= options

        return d

class PropertySingleSelectField(SingleSelectField, PropertyMixin):
    params=["nullable"]
    nullable=False
    def update_params(self, d):
        self._my_update_params(d,nullable=self.nullable)
        SingleSelectField.update_params(self, d)
        return d

class PropertyMultipleSelectField(MultipleSelectField, PropertyMixin):
    def update_params(self, d):
        self._my_update_params(d)
        MultipleSelectField.update_params(self, d)
        return d