Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Issue 4: Format knowledge in format classes

Can't Edit
Can't Publish+Mail
Start Review
Created:
1 year, 4 months ago by dwaynebailey
Modified:
1 year, 4 months ago
Reviewers:
jean.jordaan
SVN Base:
https://translate.svn.sourceforge.net/svnroot/translate/src/trunk/

Description

This is a very basic patch that looks at pushing knowledge about a format into
the format itself.

This includes:
* Extensions
* Format name
* MIME types

Programs like Pootle and VirTaal should then be able to get this information
from the format itself.  Making it possible for any of them to easily adapt to
the addition of new formats.

Patch Set 1

Patch Set 2 : Second try

Total comments: 11
Raw unified diffs Stats Side-by-side diffs with inline comments Delta from patch set
translate/storage/factory.py 1 chunk 26 lines 1 comment
translate/storage/mo.py 1 chunk 14 lines 8 comments
translate/storage/pocommon.py 1 chunk 15 lines 2 comments

Messages

Total messages: 3
dwaynebailey
http://zuza.appspot.com/4/diff/24/9 File translate/storage/pocommon.py (right): http://zuza.appspot.com/4/diff/24/9#newcode66 Line 66: name = "Gettext PO file" Some thought needs ...
1 year, 4 months ago
jean.jordaan
Just an aesthetic tweak .. http://zuza.appspot.com/4/diff/24/7 File translate/storage/factory.py (right): http://zuza.appspot.com/4/diff/24/7#newcode203 Line 203: supported.extend([(name, extension, mimetype)]) ...
1 year, 4 months ago
jean.jordaan
1 year, 4 months ago
Just some readability notes from an outsider.

http://zuza.appspot.com/4/diff/24/8
File translate/storage/mo.py (right):

http://zuza.appspot.com/4/diff/24/8#newcode53
Line 53: print "\\x%02x"*len(s) % tuple(map(ord, s))
This doesn't actually return a Python string. It looks like it may be meant for
debugging use from the commandline (i.e. print something that can be pasted into
Python code), but I don't know from the docstring.

http://zuza.appspot.com/4/diff/24/8#newcode56
Line 56: def my_swap4(result):
Docstring?

http://zuza.appspot.com/4/diff/24/8#newcode64
Line 64: def hashpjw(str_param):
English variable names please?

http://zuza.appspot.com/4/diff/24/8#newcode107
Line 107: def __init__(self, inputfile=None, unitclass=mounit):
Here and elsewhere:
"Method definitions inside a class are separated by a single blank line."
http://www.python.org/dev/peps/pep-0008/

http://zuza.appspot.com/4/diff/24/8#newcode121
Line 121: hash_cursor = V % S;
Would it hurt to expand V and S to words?

http://zuza.appspot.com/4/diff/24/8#newcode150
Line 150: hash_table = array.array("L", [0] * hash_size)
Hash tables are useful for many things. Could the name say what this one's used
for, rather than just saying that it is a hash table?

http://zuza.appspot.com/4/diff/24/8#newcode161
Line 161: string = MESSAGES[id] # id is already encoded for use as a dictionary
key
Masks 'string' module; undescriptive in same sense as 'hash_table'.

http://zuza.appspot.com/4/diff/24/8#newcode225
Line 225: context, source = source.split("\x04")
It looks like you know for certain source will never have more than one "\x04"?
Sign in to reply to this message.

Powered by Google App Engine
This is Rietveld r159