Commit graph

56 commits

Author SHA1 Message Date
Petr Viktorin 719c32de0b Make MarkdownString.as_html() accept an extension object, not class
No reason to instantiate every time as_html's called, is there?

Also, sessions use a markdown_extension attribute instead of
markdown_extension_class. The latter is only used to set the former when
the session is created (unless another markdown_extension_class is given,
of course).
2011-09-22 00:51:59 +03:00
Petr Viktorin 928eaca4a4 Make bad links in Markdown not fail
Links such as []{pokemon:mewthree} can come from users, so they should not
crash the parser.
So, when an object is not found (or more than one is found), call
identifier_url() directly, instead of failing to get the object for
object_url(). Essentially, treat the link as having an unknown category
(like mechanic:, currently).

The test that check the pokédex descriptions updated so that only
links to known objects and "mechanic:" are allowed.
2011-09-22 00:51:59 +03:00
Petr Viktorin cdac374eed Allow links to Pokémon forms in Markdown. Fixes #465
Linked-to objects aren't required to have identifiers now, so object_url()
in custom extensions might need to be changed.
The one in the test did, for example.
2011-09-22 00:51:59 +03:00
Eevee 25ab674c7c Fix this markdown extension nonsense.
Previously, every single spline-pokedex request tacked another markdown
extension onto a global list in spline, making markdown processing just
a little bit slower over time.  This is terrible.

Now we do something a little less crazy and a little more global.  Wait,
is that less crazy or more?
2011-09-06 21:52:27 -07:00
Petr Viktorin 3dc8a4cbd0 Add a sanity check for PokemonForm.order 2011-09-05 11:20:16 +03:00
Petr Viktorin 41a168a0e2 Add a missing import, remove some unused ones 2011-08-30 23:05:22 +03:00
Petr Viktorin 332647c362 Switch to py.test #604 2011-05-06 12:40:44 +03:00
Petr Viktorin c710457717 Pokemon species split: media accessors 2011-05-06 12:26:17 +03:00
Petr Viktorin ab2baaa759 Update media accessors wrt repo split
All accessors now take a `root` arg, the root of the media tree.
Alternatively `root` can be a custom MediaFile subclass, which should allow
neat tricks like:
- Checking some kind of manifest to prevent stat() calls
- Custom properties of the file objects (e.g. for HTML <img> tags)
- Downloading the media on demand

Tests assume media is at pokedex/data/media, skip otherwise.
2011-05-06 12:26:17 +03:00
Petr Viktorin dd0d225228 Pokemon species split: utilities.
Remove 'simple' altogether, as pokémon are now sane by default!
2011-05-06 12:26:16 +03:00
Petr Viktorin bc7e9128e8 Pokemon species split: Tests 2011-05-06 12:26:16 +03:00
Eevee 349fbb2d94 Merge remote-tracking branch 'origin/encukou-markdown' 2011-04-28 19:40:20 -07:00
Petr Viktorin 7d7fcc74c8 Don't set autoincrement for ids with zeroes. Test included. #580 2011-04-28 23:45:43 +03:00
Petr Viktorin b711edd511 Port the Markdown value tests from spline-pokedex. Fix remaining strings. 2011-04-28 23:43:54 +03:00
Petr Viktorin 85d779ba83 Move Markdown handling to the translation classes
- the Session has a `pokedex_link_maker` property, whose `object_url`
  method is used to make URLs in Markdown
- pokemon.names_table.name is now an ordinary Unicode column
- pokemon.name is a MarkdownString that is aware of the session and the
  language the string is in
- pokemon.name_map is a dict-like association_proxy of the above
- move.effect works similarly, with transparent $effect_chance substitution
  as before
2011-04-28 23:42:56 +03:00
Petr Viktorin 7767d546ac Don't recreate the lookup index in tests 2011-04-28 23:31:38 +03:00
Eevee b2db58afc7 Fix discrepancy between media-accessors branches. 2011-04-17 22:35:24 -07:00
Petr Viktorin 69140a88f5 Move the rest of pokedex.util.get to pokedex.db.util 2011-04-17 22:34:05 -07:00
Petr Viktorin f271812cf7 Break "simple" query functions out of pokedex.util.get 2011-04-17 22:34:05 -07:00
Petr Viktorin 2f014411e1 Add pokedex.util.get: helpers to get stuff out of the DB easily 2011-04-17 22:34:04 -07:00
Petr Viktorin 7292ede94a Test media accessors, and the media organization itself
A few tests of the accessors, along with a very dumb, long-running script
to ensure everything is in its proper place, and there's nothing but the
proper things.

For now it still finds some beta form cruft for Burmy, Pichu and Cherrim.
2011-04-17 20:55:58 -07:00
Eevee 8e1bbe0004 Merge remote-tracking branch 'origin/encukou-translations' 2011-04-17 17:43:42 -07:00
Petr Viktorin 10d9bc83b3 Mark MoveEffect.effect as a Markdown column.
Also relax the appropriate test
2011-04-12 09:51:51 +03:00
Petr Viktorin 5d18ae7ab6 Make the schema tests pass 2011-04-12 09:06:02 +03:00
Petr Viktorin 4c2ad2bdf1 Reading, merging, and writing translations 2011-04-11 17:03:27 +03:00
Eevee 08bfd753e0 Fix default language assignment once and for all.
Stop trying to be clever and magical and just make the caller pass in a
damn primary key.
2011-04-10 00:54:14 -07:00
Petr Viktorin 4291c33c00 Make MultilangSession's language class configurable 2011-04-04 21:51:35 +03:00
Petr Viktorin a06498cb39 Make a bunch of text columns nullable to support missing translations 2011-04-03 20:08:05 +03:00
Eevee d90db39d43 Fix the i18n test; now uses multilang's session subclasses. 2011-04-03 01:26:31 -07:00
Petr Viktorin ef3038d047 Remove a bad test 2011-04-01 16:08:57 -07:00
Petr Viktorin 7b93c11f7e Reorder the classes in tables.py alphabetically. Also, test the order. 2011-04-01 16:08:56 -07:00
Petr Viktorin d8840fdf5b Remove the test for filter(Pokemon.name > u"Xatu")
__gt__ and friends, you will be missed.
2011-04-01 15:59:53 -07:00
Petr Viktorin 97bf4cfe45 Update test_schema to the new API. Add some missing column metadata. 2011-04-01 15:59:53 -07:00
Petr Viktorin c4dc27732d Update test_strings.py to the new API (still fails though) 2011-04-01 15:59:52 -07:00
Petr Viktorin c25db1d2cf Add Czech romanization 2011-03-29 17:46:41 +03:00
Eevee 68e14e663e Started switching to create_translation_table.
- Moved the function to its own file.
- Implemented the session-based default language switching.
- Migrated a couple tables.
2011-03-21 22:32:52 -07:00
Eevee 6a9172151a Sigh! Remove support for strings as keys; use Language objects. 2011-03-21 17:54:28 -07:00
Eevee 1da816af4b New i18n schema thing impl, and fixed the new tests to match. 2011-03-20 01:06:45 -07:00
Eevee 542aa670ae Added a test for the i18n dynamic table generation.
It fails spectacularly, but hopefully documents what I'm ultimately
going for.
2011-03-18 18:22:18 -07:00
Petr Viktorin 2f222ca973 Make the string properties mutable 2011-03-13 15:43:42 -07:00
Petr Viktorin 2375c3117c Actually test :foo in test_crash_empty_prefix 2011-03-13 15:43:01 -07:00
Petr Viktorin bc2707f6c4 Support filtering by strings (Pokemon.name, Pokemon.names['fr'], etc.) 2011-03-13 15:43:01 -07:00
Petr Viktorin b3c7689d41 Replace all_tables by table_classes; get rid of globals() 2011-03-13 15:43:00 -07:00
Petr Viktorin d813e24b25 I18n for the database schema
- Helper base class: Named
  Subclasses: OfficiallyNamed, UnofficiallyNamed
  for these, a 'name' column is created in the appropriate text table
  also, they get automatic __str__/__repr__/__unicode__
- Faux columns: ProseColumn, TextColumn
  these become columns in the appropriate text tables
  these text tables (*_text, *_prose) are auto-generated at the end
  the main table gets one property (singular name) that gets the English text
   and one (plural name) with dict of texts keyed by language
- Every named table gets 'identifier'
- Languages compare & hash equal to their identifiers
- Existing foreign-name tables replaced by the autogenerated ones
- order_by: names replaced by identifiers
- New function: all_tables(), yields all tables
- Markdown move properties removed for now
- Schema test suite
2011-03-13 15:10:10 -07:00
Eevee 4414bab714 Lots of encounters were using slots that claimed to be for other games. #297 #281 2011-01-27 20:44:56 -08:00
Eevee 2b6ea2be0a Added tests for form lookup, fixing the suite. 2010-12-01 12:06:45 -08:00
Eevee cf72e1db36 Crash fix: lookup with empty prefixes. 2010-09-12 21:08:50 -07:00
Eevee 3ea1174a31 Make user and code valid_types not interfere when one is language and the other is table. 2010-08-24 23:49:48 -07:00
Eevee 2431fd6754 Allow restricting lookup by language, with a @ja: prefix. #90 2010-08-24 23:49:47 -07:00
Eevee 79df4768bf Split PokedexLookup(recreate=True) into its own method. #216 2010-05-12 22:38:36 -07:00