Commit graph

352 commits

Author SHA1 Message Date
Andrew Ekstedt
739c6fdd7c Sort relationships by creation order.
Also:

- Split association proxies into their own section.

- Remove relationship_info.
2012-06-08 23:31:35 -07:00
Andrew Ekstedt
04b941755a Introspect relationships directly.
Possibly more fragile, but this way we don't need _set_relationships.

SQLAlchemy version bump for AssociationProxy.remote_attr.
2012-06-08 23:29:44 -07:00
Lynn "Zhorken" Vaughan
6e103af3e0 Order PokemonEggGroup.species by Pokémon *species* order. 2012-06-07 02:07:29 -04:00
Lynn "Zhorken" Vaughan
4aa637caf2 Fix form_order's description in tables.py. 2012-06-07 02:05:10 -04:00
Lynn "Zhorken" Vaughan
ec048f3221 Add and populate pokemon_species.order. 2012-06-06 23:32:10 -04:00
Lynn "Zhorken" Vaughan
649162e79e Add and populate pokemon_forms.form_order. 2012-06-06 23:28:30 -04:00
Andrew Ekstedt
48c3eff597 Turn PalPark.area Enum into a table. 2012-06-02 00:17:53 -07:00
Andrew Ekstedt
6e2f7af7b2 Add Pal Park data. 2012-06-01 18:14:23 -07:00
Eevee
3511bf3076 Ahem, ACTUALLY drop types when loading. 2012-03-31 21:30:05 -07:00
Eevee
987116f662 Fix duplicate type errors when loading into postgresql. 2012-03-30 23:33:48 -07:00
Eevee
5338d44272 Merge pull request #69 from encukou/i18n
Allow ordering and filtering on translatable texts, e.g. `Move.name`
2012-03-25 01:22:39 -07:00
Lynn "Zhorken" Vaughan
12b87852c6 Add game indices for the main six stats. 2012-03-20 03:33:18 -04:00
Lynn "Zhorken" Vaughan
61ed3c4ccb Add a VersionGroup.machines relationship. 2012-02-29 00:33:03 -05:00
Lynn "Zhorken" Vaughan
cdf052555b Eagerload Pokemon.forms.
This fixes all those spline-pokedex tests that broke when I fixed
Pokémon name display.
2012-02-28 21:28:58 -05:00
Eevee
75287587a2 Merge pull request #66 from encukou/internal-ids
Add internal IDs to forms
2012-02-28 17:14:43 -08:00
Eevee
0e766d309c Merge pull request #65 from encukou/xd-tutor
Add the VersionGroupPokemonMoveMethod table
2012-02-23 19:42:31 -08:00
Lynn "Zhorken" Vaughan
2073fa5089 Support null regional Pokédex for Colosseum/XD. #70 2012-02-16 11:37:04 -05:00
Petr Viktorin
391fd1c1ac Support association proxies 2012-02-12 23:43:14 +01:00
Petr Viktorin
ef3fb2f536 Move relationships to _add_relationships calls: Pokemon 2012-02-12 23:43:14 +01:00
Petr Viktorin
949ff883ea Autodoc for backrefs 2012-02-12 22:45:10 +01:00
Petr Viktorin
0cb1f8a1b8 Make the table schema a bit more introspectable
This solves two problems: first, the relationships are now defined in
the class they apply to, rather than in a separate section of the module,
and second, their metadata -- both creation arguments and extra info such
as `description` (or, later, possibly, info for API properties) -- is
stored.
2012-02-12 16:19:09 +01:00
Petr Viktorin
96499fae30 Allow ordering and filtering on translated texts, e.g. Move.name 2012-02-12 09:50:04 +01:00
Petr Viktorin
50b08d94d9 Make a few __get__ methods work properly on their class
Automatic doc generation requires this.
2012-02-11 22:54:46 +01:00
Petr Viktorin
81f2c83ad5 Allow ordering and filtering on translated texts, e.g. Move.name 2012-02-11 21:05:52 +01:00
Petr Viktorin
5b7e13892a Add pokemon_form_generations, with internal game indices
Fixes #63
2012-02-11 13:08:54 +01:00
Petr Viktorin
216e4c8462 Typo fix 2012-02-11 09:12:17 +01:00
Eevee
897c6f1de1 Merge pull request #64 from veekun/zhorken
Fixes some move data issues and form bugs.
2012-02-05 21:29:22 -08:00
Petr Viktorin
48f3957aab Add the VersionGroupPokemonMoveMethod table 2012-02-06 00:43:47 +01:00
Petr Viktorin
73cf9c036c Use VersionGroup.order in a bunch of relationships 2012-01-30 18:17:00 +01:00
Petr Viktorin
1134415e13 Introduce an order column for version groups
Some code in spline-pokedex orders by `id`, which has worse consequences
than it may seem (e.g. instead of defaulting to most recent games, the
comparifier defaults to XD). This is the first step to fixing that.
2012-01-30 14:09:05 +01:00
Lynn "Zhorken" Vaughan
111394315e Fix the indiscriminate display of Pokémon with their form names. 2012-01-24 00:24:02 -05:00
Petr Viktorin
3607b9b3e1 Let MoveEffectProperty be None if the move_effect is None
MoveChangelog.move_effect is None if there is no effect change.
Its .effect should just be None as well.
2011-11-14 21:17:12 +02:00
Petr Viktorin
ebab8c6e43 Try importing markdown utilities from markdown.util
etree and AtomicString will be moved in python-markdown 2.1

See commit https://github.com/waylan/Python-Markdown/commit/89a4f3d0829a7 :
    Cleaned up markdown namespace. This may be a backward incompatible
    change for some extensions. They should be importing from
    markdown.util
2011-09-22 00:51:59 +03:00
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
Petr Viktorin
d8d32a0176 Use identifiers in Pokemon.stat 2011-09-22 00:51:59 +03:00
Eevee
a11261e529 Fix a stupid closure-in-loop problem. #654 #655 2011-09-11 17:27:58 -07: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
Eevee
3a59ef1fe0 Update us to SQLAlchemy 0.7. #582 2011-09-04 23:19:56 -07:00
Petr Viktorin
bb49a6bc39 Fix a Unicode docstring 2011-08-30 23:05:28 +03:00
Petr Viktorin
41a168a0e2 Add a missing import, remove some unused ones 2011-08-30 23:05:22 +03:00
Eevee
10ce391098 Nicer docstrings for the three "pokemon" tables we have now. 2011-08-29 20:36:06 -07:00
Petr Viktorin
dd668febe7 Make id lookup util.get use query.get, avoiding queries for dupe lookups 2011-05-06 12:40:44 +03:00
Petr Viktorin
3034c04d59 Allow missing Markdown translation rows (for species' form descriptions) 2011-05-06 12:26:16 +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
d0c01810be Pokemon species split: Lookup & Markdown 2011-05-06 12:26:16 +03:00
Petr Viktorin
8309b316f2 Add is_default to Pokemon. Revise forms' is_default accordingly. 2011-05-06 12:26:16 +03:00
Petr Viktorin
bc244aeb53 Pokemon species split: DB metadata changes 2011-05-06 12:26:16 +03:00
Petr Viktorin
280c90b966 Pokemon species split: Schema changes 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
f7a9c28e60 Rename MoveFlagType/MoveFlag to MoveFlag/MoveFlagMap. #591 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
059f7dfc55 Autofill empty labels in Markdown links
- as_text() is now a function that takes the session as an argument
- likewise as_html(), which also takes URL makers and the language
- since there should be only one link extension, it is registered by
  setting default_link_extension, not appending to markdown_extensions.
  This only affects the __html__ attribute.
2011-04-28 23:42:56 +03:00
Petr Viktorin
051d6563a4 Don't try to replace the $effect_chance in missing effect translations 2011-04-28 23:42:56 +03:00
Petr Viktorin
98dcc613e2 Use relationship() instead of the deprecated relation(). #596 2011-04-28 23:31:38 +03:00
Petr Viktorin
3c17720a1c order_by_name: properly fall back to the specified languages, or identifier
Sometimes, translations are incomplete. Handle this gracefully by allowing
fallback languages. If there are none, fall back to the identifier to get
at least some order.
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
1f2df80a00 Make Pokemon.form an actual relation 2011-04-17 22:34:03 -07:00
Petr Viktorin
4cd68fb5e3 Typo: multilang docstring was wrong 2011-04-17 22:34:02 -07:00
Petr Viktorin
11c0c4778b Add media accessors 2011-04-17 20:55:57 -07:00
Petr Viktorin
0f7feab591 Make PokemonForm.pokemon an actual relation 2011-04-17 17:45:10 -07:00
Petr Viktorin
27d33556d4 Load local_language lazily 2011-04-17 17:45:10 -07:00
Eevee
8e1bbe0004 Merge remote-tracking branch 'origin/encukou-translations' 2011-04-17 17:43:42 -07:00
Petr Viktorin
695347bcff Update markdown.py docstring 2011-04-12 11:10:36 +03: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
f42f5f32d0 Expand some string limits so links with identifiers can fit 2011-04-12 09:06:04 +03:00
Petr Viktorin
5d18ae7ab6 Make the schema tests pass 2011-04-12 09:06:02 +03:00
Petr Viktorin
34a8070449 Load translations in pokedex load. 2011-04-11 17:07:38 +03:00
Petr Viktorin
817c4c289d Don't dump unofficial translations in pokedex dump
(Translations cannot be dumped properly because the source string hash
isn't in the database.)

By default, unofficial texts are only dumped for English, but that can
be configured if someone wants CSVs for different language(s).

Official texts (<thing>_names rows for official languages) are always
dumped.
2011-04-11 17:07:37 +03:00
Petr Viktorin
4c2ad2bdf1 Reading, merging, and writing translations 2011-04-11 17:03:27 +03:00
Eevee
36fa8b7093 Fix a misuse of a set as a dictionary in db loading. 2011-04-10 18:51:03 -07:00
Eevee
28d81cc25f Rearranged evolution table; added new B/W evolutions. #378
There are now (well, have been for a while) multiple ways to evolve
a Pokémon from its unique parent, so the current schema wasn't working.
The parent Pokémon has moved back to the main pokemon table, and
pokemon_evolution has grown an artificial primary key.

New evolution methods for Milotic, Leafeon, Glaceon, Magnezone, and
Probopass have been added.
2011-04-10 16:33:18 -07: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
Eevee
f666327fa0 Remove old move effect categories. #389 2011-04-09 22:58:40 -07:00
Eevee
8de33be206 Added identifiers for move meta categories. 2011-04-09 22:22:58 -07:00
Eevee
8e2ad429d9 hurp durp default language 2011-04-05 23:34:28 -07:00
Eevee
905f5b3d13 Merge remote-tracking branch 'origin/encounters-i18n'
Conflicts:
	pokedex/db/__init__.py
2011-04-05 22:32:51 -07:00
Eevee
5b0f290ec5 Unbreak db.connect(), whoops. 2011-04-05 21:46:11 -07:00
Eevee
acf44c63a0 Merge branch 'encukou' 2011-04-05 21:04:32 -07:00
Eevee
9441ffb165 Remove the responsibility of setting a default language from multilang.
Caller now has to do it.  No need to avoid circular deps, no need to do
much of anything at all.
2011-04-05 21:03:41 -07:00
Eevee
ef29dd667c Always joinedload the local_language for a full language map. 2011-04-05 20:48:10 -07:00
a_magical_me
841694f83f Add R/S/E encounters. #136
- They actually have LocationAreaEncounterRates this time!

- Make EncounterSlots.rarity nullable, since my script requires it.
2011-04-04 17:48:10 -07:00
a_magical_me
c9a3ceb88f Rename terrain => method. #375
They aren't actually terrains, and i need that name for another table.
2011-04-04 17:48:05 -07:00
a_magical_me
7b7c0addde Add B/W locations. #375
English and Japanese. Woo!

The text dump contained a bunch of duplicate location names (possibly
for the Entralink?).  I've merged them in the locations table, but
location_game_indices still has the duplicates—that is, a location can
now have multiple game_index values in one generation (necessitating a
small schema change).
2011-04-04 17:09:11 -07:00
Petr Viktorin
4291c33c00 Make MultilangSession's language class configurable 2011-04-04 21:51:35 +03:00
Petr Viktorin
9fdb8e1bd0 Make session.default_language set/get work 2011-04-04 04:18:37 +03:00
a_magical_me
dbb293e727 Add identifier_from_name() function.
Adapted from name2ident() in scripts/migration-i18n.py.
2011-04-03 15:32:11 -07:00
a_magical_me
34a888cc16 Revert "Added a bunch of autoincrement=False."
This reverts commit e68f43a5aee1b8fe145c416df6fa0015b54efd5c,
because it was a bloody terrible idea.
2011-04-03 15:20:53 -07:00
Petr Viktorin
8cddfefc4c Add __repr__ to mapped classes
This makes string representations of lists, tuples, dicts, etc. with the
DB objects make sense
2011-04-03 21:18:37 +03:00
Petr Viktorin
a06498cb39 Make a bunch of text columns nullable to support missing translations 2011-04-03 20:08:05 +03:00
Petr Viktorin
6f36907341 Enable nullable MarkdownColumns 2011-04-03 20:08:04 +03:00
Petr Viktorin
105d9422ca Change item short effect format to markdown 2011-04-03 19:34:18 +03:00
a_magical_me
bbb7cb9907 Make load.py more idiomatic.
Also snuck an idiom into db/__init__.py.
2011-04-03 04:26:45 -07:00
a_magical_me
9340f24ae4 load: Add --recursive option.
Helps somewhat with #526 (`pokedex load` is slow) by making it easier to
load only the tables you're interested in.
2011-04-03 03:17:08 -07:00
a_magical_me
bc0b4acb84 Add MarkdownString.__html__(). 2011-04-03 03:17:04 -07:00
a_magical_me
b924a82236 Remove all uses of str.format().
For Python 2.5 compatibility.
2011-04-03 03:16:52 -07:00