ConDict

Check-in [45df65e986]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:merge main functionality
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1:45df65e986eb2372455e694eb1a00d9bed34b6b9
User & Date: zorro 2012-10-17 17:54:04
Context
2012-10-17
17:54
merge main functionality Leaf check-in: 45df65e986 user: zorro tags: trunk
11:10
fixed bug in command .info check-in: e03a7f02c8 user: alzay tags: testing
2012-10-13
15:36
merge with testing check-in: ecc710b2d0 user: zorro tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to condt.py.

68
69
70
71
72
73
74


75
76
77
78
79
80
81
...
110
111
112
113
114
115
116

117
118
119
120
121
122
123
...
720
721
722
723
724
725
726
727


















            'full': 'start ru-en test'},
        '.testmix': {'desc': 'start en-ru test', 'command': None,
            'full': 'start mix test'},
        '.testinfo': {'desc': 'information by test', 'command': None,
            'full': 'full test information by test ID'},
        '.testlist': {'desc': 'list of tests', 'command': None,
            'full': 'this command print list of your tests'},


        }
    def __init__(self, name, dbfile, debug, ctest=10):
        super().__init__(name, dbfile, debug)       
        self.__pcounter = 3
        self.ctest = ctest
        self.init_command()
        self.user_id = self.get_user()
................................................................................
        self.COMMANDS['.edit']['command'] = self.command_edit
        self.COMMANDS['.delete']['command'] = self.command_delete
        self.COMMANDS['.test']['command'] = self.command_testen
        self.COMMANDS['.testru']['command'] = self.command_testru
        self.COMMANDS['.testmix']['command'] = self.command_testmix
        self.COMMANDS['.testlist']['command'] = self.command_testlist
        self.COMMANDS['.testinfo']['command'] = self.command_testinfo


    def hash_pass(self, password):
        """create password hash: text => hast string"""
        result = bytes(password.strip() + SALT, 'utf-8')
        result = bytes(hashlib.md5(result).hexdigest(), 'utf-8')
        return hashlib.sha1(result).hexdigest()

................................................................................
            self.prer(er)
            print("Error, use <.tesinfo ID> (ID - number)")
        except sqlite3.DatabaseError as er:
            self.prer(er)
            print("Error")
        cur.close()
        return 'testinfo'


























>
>







 







>







 








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
...
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
...
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
            'full': 'start ru-en test'},
        '.testmix': {'desc': 'start en-ru test', 'command': None,
            'full': 'start mix test'},
        '.testinfo': {'desc': 'information by test', 'command': None,
            'full': 'full test information by test ID'},
        '.testlist': {'desc': 'list of tests', 'command': None,
            'full': 'this command print list of your tests'},
        '.info': {'desc': 'information about dictionary', 'command': None,
            'full': 'print information: user info, dictionary info, test info'},
        }
    def __init__(self, name, dbfile, debug, ctest=10):
        super().__init__(name, dbfile, debug)       
        self.__pcounter = 3
        self.ctest = ctest
        self.init_command()
        self.user_id = self.get_user()
................................................................................
        self.COMMANDS['.edit']['command'] = self.command_edit
        self.COMMANDS['.delete']['command'] = self.command_delete
        self.COMMANDS['.test']['command'] = self.command_testen
        self.COMMANDS['.testru']['command'] = self.command_testru
        self.COMMANDS['.testmix']['command'] = self.command_testmix
        self.COMMANDS['.testlist']['command'] = self.command_testlist
        self.COMMANDS['.testinfo']['command'] = self.command_testinfo
        self.COMMANDS['.info']['command'] = self.command_info

    def hash_pass(self, password):
        """create password hash: text => hast string"""
        result = bytes(password.strip() + SALT, 'utf-8')
        result = bytes(hashlib.md5(result).hexdigest(), 'utf-8')
        return hashlib.sha1(result).hexdigest()

................................................................................
            self.prer(er)
            print("Error, use <.tesinfo ID> (ID - number)")
        except sqlite3.DatabaseError as er:
            self.prer(er)
            print("Error")
        cur.close()
        return 'testinfo'

    def command_info(self, arg=None):
        cur = self.connect.cursor()
        # user
        cur.execute("SELECT `name`, `full` FROM `user` WHERE `id`=(?)", (self.user_id,))
        result = cur.fetchone()
        print("{0}: {1}".format(*result))
        cur.execute("SELECT COUNT(*) FROM `translate` WHERE `user_id`=(?) GROUP BY `user_id`", (self.user_id,))
        result = cur.fetchone()
        print("There are {0} records in user dictionary".format(result[0]))
        cur.execute("SELECT COUNT(*) FROM `test` WHERE `user_id`=(?) GROUP BY `user_id`", (self.user_id,))
        result = cur.fetchone()
        cur.execute("SELECT COUNT(`result`.`id`) FROM `result` LEFT JOIN `test` ON (`result`.`test_id`=`test`.`id`) WHERE `test`.`user_id`=(?) GROUP BY `test`.`user_id`", (self.user_id,))
        results = cur.fetchone()
        print("There are {0} tests, with {1} results".format(result[0], results[0]))
        cur.close()
        return 'info'


Changes to db.sqlite.

cannot compute difference between binary files