Minor fixes to the docs

- Fix warning about unicode param receiving byte strings
- Add missing verb to a sentence
This commit is contained in:
Petr Viktorin 2012-07-08 20:25:43 +02:00
parent e263c42e6c
commit f7e880ca2b
1 changed files with 7 additions and 7 deletions

View File

@ -10,7 +10,7 @@ Here is a small example of using pokedex:
from pokedex.db import connect, tables, util from pokedex.db import connect, tables, util
session = connect() session = connect()
pokemon = util.get(session, tables.PokemonSpecies, 'bulbasaur') pokemon = util.get(session, tables.PokemonSpecies, u'bulbasaur')
print u'{0.name}, the {0.genus} Pokemon'.format(pokemon) print u'{0.name}, the {0.genus} Pokemon'.format(pokemon)
Running this will give you some Bulbasaur info: Running this will give you some Bulbasaur info:
@ -25,8 +25,8 @@ Connecting
To get information out of the Pokédex, you will need to create a To get information out of the Pokédex, you will need to create a
:class:`Session <pokedex.db.multilang.MultilangSession>`. To do that, use :class:`Session <pokedex.db.multilang.MultilangSession>`. To do that, use
:func:`pokedex.db.connect`. For simple uses, you don't need to give it any :func:`pokedex.db.connect`. For simple uses, you don't need to give it any
arguments: it the database that ``pokedex load`` fills up by default. If you arguments: it uses the database that ``pokedex load`` fills up by default. If
need to select another database, give its URI as the first argument. you need to select another database, give its URI as the first argument.
The object :func:`~pokedex.db.connect` gives you is actually a The object :func:`~pokedex.db.connect` gives you is actually a
:class:`SQLAlchemy session <sqlalchemy.orm.session.Session>`, giving you the :class:`SQLAlchemy session <sqlalchemy.orm.session.Session>`, giving you the
@ -57,15 +57,15 @@ its identifier, name, or ID, and returns it.
def print_pokemon(pokemon): def print_pokemon(pokemon):
print u'{0.name}, the {0.genus} Pokemon'.format(pokemon) print u'{0.name}, the {0.genus} Pokemon'.format(pokemon)
print_pokemon(util.get(session, tables.PokemonSpecies, identifier='eevee')) print_pokemon(util.get(session, tables.PokemonSpecies, identifier=u'eevee'))
print_pokemon(util.get(session, tables.PokemonSpecies, name=u'Ho-Oh')) print_pokemon(util.get(session, tables.PokemonSpecies, name=u'Ho-Oh'))
print_pokemon(util.get(session, tables.PokemonSpecies, id=50)) print_pokemon(util.get(session, tables.PokemonSpecies, id=50))
def print_item(item): def print_item(item):
print u'{0.name}: ${0.cost}'.format(item) print u'{0.name}: ${0.cost}'.format(item)
print_item(util.get(session, tables.Item, identifier='great-ball')) print_item(util.get(session, tables.Item, identifier=u'great-ball'))
print_item(util.get(session, tables.Item, name='Potion')) print_item(util.get(session, tables.Item, name=u'Potion'))
print_item(util.get(session, tables.Item, id=30)) print_item(util.get(session, tables.Item, id=30))
.. testoutput:: .. testoutput::
@ -154,7 +154,7 @@ example:
query = session.query(tables.Move) query = session.query(tables.Move)
query = query.join(tables.Move.type) query = query.join(tables.Move.type)
query = query.filter(tables.Type.identifier == 'grass') query = query.filter(tables.Type.identifier == u'grass')
query = query.filter(tables.Move.power >= 100) query = query.filter(tables.Move.power >= 100)
query = query.order_by(tables.Move.power) query = query.order_by(tables.Move.power)
query = query.order_by(tables.Move.name) query = query.order_by(tables.Move.name)