Closed Bug 458445 Opened 15 years ago Closed 14 years ago

[silme] Clean code in silme.core.diff, silme.fp.* and silme.io.*

Categories

(Mozilla Localizations :: Infrastructure, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: zbraniecki, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

I have to clean code in silme.core.diff (merge with silme.playground.diff?) and silme.fp and silme.io.
I'm currently working on this.

diff has been moved to silme.diff, silme.playground has been removed (l10nObjectDiff landed in silme.diff.l10nobject) and I'm currently cleaning Diff objects.
Status: NEW → ASSIGNED
ok, diff API is more stable now, working on performance
this should do the trick
Attachment #344468 - Flags: review?(akalla)
Attachment #344468 - Attachment is patch: true
Attachment #344468 - Attachment mime type: application/octet-stream → text/plain
update
Attachment #344468 - Attachment is obsolete: true
Attachment #344516 - Flags: review?(akalla)
Attachment #344468 - Flags: review?(akalla)
Attachment #344516 - Flags: review?(akalla) → review+
http://hg.mozilla.org/users/zbraniecki_mozilla.com/silme/rev/078355727e97

What happened in this changeset is a huge cleanup for silme.fp. It removes whole silme.fp.object chunk which was not needed anymore and replaces it with smart loading.

So, instead of manually importing:

import silme.fp.object.dtd
import silme.fp.object.properties

you can simply do:

silme.format.Manager.get('dtd')

which will try to load dtd module and register it properly.

You can also do:

silme.format.Manager.register_all()

in order to load all available format parsers.

Next step is to decide what we want to do with silme.fp.diff.* (I'm leaning toward removing it for now since it doesn't work) and making it possible to block loading new types.

Case scenario is that if I decided which format parsers I want to support (say, properties, dtd) I should be able to say "no more". Currently if script finds new type of file it will try to load proper format parser.
http://hg.mozilla.org/users/zbraniecki_mozilla.com/silme/rev/6a60c150cce6
http://hg.mozilla.org/users/zbraniecki_mozilla.com/silme/rev/038ff737bcca

Those two are adding diff functionality to silme.format.text.Serializer and are removing whole silme.fp.*

Wohoo! :)
So in order to get this working what you have to change in your script is:

1) remove any import silme.fp - use import silme.format instead
2) switch any reference to silme.fp.Manager to silme.format.Manager
3) to add support for format - silme.format.Manager.register('dtd') or silme.format.Manager.register_all()
4) if you rely on silme.io.* to choose the right format, it'll do that. :)
5) if you get format from path use silme.format.Manager.get(path=foo) if you get from name silme.format.Manager.get(name=foo)

That's all!

I'll revise that tomorrow, but this sounds like done :)
yup, that's fixed!
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Blocks: 478225
You need to log in before you can comment on or make changes to this bug.