ConDict

Check-in [26d3eed801]
Login

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

Overview
Comment:add .list-command
Timelines: family | ancestors | descendants | both | testing
Files: files | file ages | folders
SHA1:26d3eed8013c174c1ecceed690cf5739f8538d1d
User & Date: zorro 2012-09-05 18:14:41
Context
2012-09-05
18:18
create func pattern for edit/add/del check-in: d3d59fd363 user: zorro tags: testing
18:14
add .list-command check-in: 26d3eed801 user: zorro tags: testing
07:06
print YT connection error for users check-in: fad2edb2aa user: alzay tags: testing
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to condt.py.

209
210
211
212
213
214
215
216



217













218
219
        if not result or result['code'] != 200:
            return "Error, not foud translate"
        print(result['text'])
        return 0

    def command_list(self, pattern=None):
        cur = self.connect.cursor()
        sql_list = "SELECT term.en, translate.rus FROM translate LEFT JOIN term ON (translate.term=term.token) WHERE translate.user_id=(?) ORDER BY translate.created DESC"



        print('search by pattern')













        cur.close()
        return 'list'







|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>


209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
        if not result or result['code'] != 200:
            return "Error, not foud translate"
        print(result['text'])
        return 0

    def command_list(self, pattern=None):
        cur = self.connect.cursor()
        sql_list = "SELECT `translate`.`id`, `term`.`en`, `translate`.`rus`, `progress`.`all`, `progress`.`error` FROM `translate` LEFT JOIN `term` ON (`translate`.`term`=`term`.`token`) LEFT JOIN `progress` ON (`progress`.`translate_id`=`translate`.`id`) WHERE `translate`.`user_id`=(?) "
        params = (self.user_id,)
        result_text, result_param = "Get {0} rows", [0]

        if pattern:
            sql_list += " AND `term`.`en` LIKE (?)"
            params = (self.user_id, pattern + '%')
            result_text = "Get {0} rows for pattern '{1}%'"
            result_param.append(pattern)
        sql_list += " ORDER BY `translate`.`created` DESC"
        cur.execute(sql_list, params)
        i = 1
        for row in cur.fetchall():
            print("{0}. ID={1} all {2}, error {3}".format(i, row[0], row[3], row[4]))
            print("\t(en) {0}\n\t(ru) {1}".format(row[1], row[2]))
            i +=1
        result_param[0] = i - 1
        print(result_text.format(*result_param))
        cur.close()
        return 'list'

Changes to db.sqlite.

cannot compute difference between binary files