This file is indexed.

/usr/share/pyshared/tryton/gui/window/view_form/view/form_gtk/integer.py is in tryton-client 2.2.1-1.

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
#This file is part of Tryton.  The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
from char import Char
import locale


class Integer(Char):
    "Integer"

    def __init__(self, field_name, model_name, attrs=None):
        super(Integer, self).__init__(field_name, model_name, attrs=attrs)
        self.entry.set_width_chars(8)
        _, _, padding, pack_type = self.widget.query_child_packing(
            self.entry)
        self.widget.set_child_packing(self.entry, False, False,
            padding, pack_type)
        self.entry.set_max_length(0)
        self.entry.set_alignment(1.0)
        self.entry.connect('insert_text', self.sig_insert_text)

    def set_value(self, record, field):
        try:
            value = locale.atoi(self.entry.get_text())
        except ValueError:
            value = 0
        return field.set_client(record, value)

    def display(self, record, field):
        # skip Char call because set_text doesn't work with int
        super(Char, self).display(record, field)
        if not field:
            self.entry.set_text('')
            return False
        self.entry.set_text(locale.format('%d',
            field.get(record) or 0, True))

    def sig_insert_text(self, entry, new_text, new_text_length, position):
        value = entry.get_text()
        position = entry.get_position()
        new_value = value[:position] + new_text + value[position:]
        if new_value == '-':
            return
        try:
            locale.atoi(new_value)
        except ValueError:
            entry.stop_emission('insert-text')