When we converted addons.mozilla.org from PHP to Python I mentioned how
deceptively large (lines of code) the site had grown with so many views and
features. We’ve since built marketplace.firefox.com on literally the same code
base (a decision I hoped to blog about some day, alas) and the line count
continues upwards. The MVC paradigm
is one of the most common out there, easy to understand, and built in to our
frameworks so it was naturally a good choice. However, as the site continues to
expand we’ve had to review what the best architecture for the code would be and
the main point that stands out is that our entire site and its services are a
monolithic blob of code. Both sites, all of our APIs, all of the PayPal code, the administrative
tools, the developer control panel, the reviewer queues, the list goes on - it’s
all in one repository and changing one means potentially affecting all of them.
I moved around a lot over the past year and ended up putting a bunch of old
t-shirts into a trunk and forgetting about them. My one-o-clock-in-the-morning
brain decided now was a good time to go through the trunk and get rid of all
those old shirts I never wear. It turns out we Mozillians used to really like
making t-shirts. Below is a pile of shirts I found from around 2005-2011 or so.
How many can you identify?
A few months ago Tim Morgan emailed the Portland OWASP chapter and suggested
that we organize a meeting where everyone could get together and audit some
existing software. When vulnerabilities were found we would follow the
responsible disclosure life cycle and notify the maintainers before publicly
disclosing. It would be a fun way to spend an afternoon, people would get
experience with responsible hacking, and the software maintainers would have the
opportunity improve their software. The idea gained traction and FLOSSHack One was
born.
Last week Greg Koberger finally got me to cross "add a test locale to AMO" off my list - and it turns out it only took a few minutes of actual coding. It sounds like others have had some troubles so I wanted to run through what I did.
Firstly, you can see what I'm talking about at the AMO dev site. I'm using a script in the Translate Toolkit called podebug to generate a .po file filled with unicode characters. You can also generate one which surrounds the strings with "xxx" or blanks them out, etc. The goal is to easily see what strings on your website can't be localized (this means they aren't in the .po files for localizers).
If you're using product-details to get locale names make sure you're using the latest revision - I added dbg to the array so it will show up in language dropdowns like all the other languages. After that I added dbg to Django's LANGUAGES define[1]. At that point the language showed up, but we'd get tracebacks if we tried to format money in a string since 'dbg' was a fake language. AMO uses Babel for details about each locale so I just made a wrapper for the Babel Locale() function and told it to use 'en' if it saw 'dbg'. This way 'dbg' is used for all the strings on the site but for any complex formatting we fall back to en. This works since dbg is based off en anyway, as far as pluralizations are concerned. You can see my commit which added that function and made sure we started using it here.
This also works on the marketplace.
[1] I actually added it to AMO_LANGUAGES which gets to LANGUAGES in a slightly round-about way. See our settings.py file for how that flow works.
Last year we set up landfill.amo to give contributors an easy base to set up the addons.mozilla.org site. Easy is relative here, of course, but it was a big leap over what we had at the time.
Kumar leapfrogged that milestone by adding Vagrant configuration scripts to our repository. Now you can have a running version of AMO on your local system in about 3-5 commands[1].
Check out the steps to install AMO with Vagrant to see how. I set it up on OS X last week and aside from waiting for the download it only took a few minutes. Drop by #amo on IRC if you run into any troubles.
[1] Setting this up on Windows is apparently more difficult although one contributor did find success after fighting with it for some time.
Edit: Updated the installation instructions URL