aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/util.py
Commit message (Collapse)AuthorAgeFilesLines
* Create function to search media by slug.Elrond2012-03-161-2/+4
| | | | | | | | | Searching media by slug is easy on mongo. But doing the joins in sqlalchemy is not as nice. So created a function for doing it. Well, and create the same function for mongo, so that it also works.
* Generic check_media_slug_used db utility.Elrond2012-03-051-2/+2
| | | | | | | | In two cases (generating a new slug and editing the slug) it is nice to know in advance (before the db gets angry) that the slug is used/free. So created a db utility function to check for this on mongo and sql: check_media_slug_used()
* Implement atomic_update for SQL.Elrond2012-03-041-0/+1
| | | | | | On sqlalchemy most updates are atomic enough for most use cases. Anyway, here is an atomic_update that is compatible to the mongo version.
* Create atomic_update db utility functionElrond2012-03-041-1/+2
| | | | | | | | | In some cases (notably the mark_entry_failed function) it is useful to have atomic update functionality on the db. On mongo this requires special syntax. So created an atomic_update function for mongo and started to use it in mark_entry_failed.
* It's 2012 all up in hereChristopher Allan Webber2012-02-021-1/+1
|
* Add develover sql switchElrond2012-01-281-2/+9
| | | | | | | | | | | | | | | | | If you want to play with the current state of sql, you need a switch to turn it on. So here is the super secret developer switch. So you want to know where it is? Here it is: Create a file mediagoblin/db/sql_switch.py and put one line in it: "use_sql = True" (or False to disable again). Right, that's it. If you want to delete it, remember to delete the *.pyc too. Be careful not to "git add" it by accident!
* Import MigrationManager from mongo in mongo backend.Elrond2012-01-041-1/+1
| | | | | | Inside the mongo db backend, use the mongo MigrationManager. This is hopefully the last reference to the generic MigrationManager reference on db.util.
* Move db/util.py -> db/mongo/util.pyElrond2011-12-201-276/+2
| | | | | - Change some reference - Provide a wrapper db/util.py
* Move db/indexes.py to db/mongo/indexes.pyElrond2011-12-201-1/+1
| | | | And change references (one!).
* has_key is deprecated, converting uses to use "in" operator.Nathan Yergler2011-10-011-1/+1
|
* Whitespace and formatting cleanup.Nathan Yergler2011-10-011-2/+3
| | | | | | | * Removed trailing whitespace * Line length < 80 where possible * Honor conventions on number of blank lines * Honor conventions about spaces around :, =
* 508. Updates copyright/license informationWill Kahn-Greene2011-09-011-1/+1
|
* Merge branch 'master' into f411_new_migrationsChristopher Allan Webber2011-07-131-3/+10
|\ | | | | | | | | Conflicts: mediagoblin/db/open.py
| * Changing things back so that we keep information about deprecatedChristopher Allan Webber2011-07-091-3/+10
| | | | | | | | indexes around.
* | Duplicate migration numbers not allowed, broChristopher Allan Webber2011-07-131-0/+2
| |
* | We should *raise* MissingCurrentMigration :)Christopher Allan Webber2011-07-131-1/+1
| | | | | | | | Thanks for the catch, Elrond.
* | Made it so that it's migrate_new() which installs the migrationChristopher Allan Webber2011-07-101-3/+18
| | | | | | | | version if missing, migrations_to_run just throws an error if not set
* | No reason to have migration_number optional or default to NoneChristopher Allan Webber2011-07-101-1/+1
| |
* | Move the call to install_migration_version_if_missing() to migrations_to_run()Christopher Allan Webber2011-07-101-5/+7
| | | | | | | | | | This means there's a serious side effect of calling this, but there's no way to get useful data here unless if that's set anyway.
* | install_migration_version_if_missing() now a separate functionChristopher Allan Webber2011-07-101-7/+19
| | | | | | | | | | Also added it to MigrationManager.migrate_new(), because we'll always need a migration number when migrating.
* | Make sure all these strings in db/util.py are unicodeChristopher Allan Webber2011-07-101-6/+6
| |
* | Simpler run_migrations method.Christopher Allan Webber2011-07-101-16/+13
| | | | | | | | | | | | | | | | Allows for calbacks, should be useful for printing output and catching things in tests. Gets rid of the generator stuff which now that I think of it is a messy idea.
* | Making sure migration_number > 0 :)Christopher Allan Webber2011-07-091-1/+3
| |
* | run_new_migrations() makes more senseChristopher Allan Webber2011-07-091-1/+1
| |
* | Some instructions in the RegisterMigration docstring on how to use.Christopher Allan Webber2011-07-091-0/+13
| |
* | latest_migration now returns migration numbers only, and 0 if no migrations.Christopher Allan Webber2011-07-091-6/+10
| |
* | Migrating quietly, not iteratively, that comment should say!Christopher Allan Webber2011-07-091-1/+1
| |
* | New migration utility code.... I haven't tested this! ;)Christopher Allan Webber2011-07-091-0/+136
|/ | | | | | | | I think it's looking right though. - Provides MigrationManager which should have plenty of utilities for doing migrations hopefully correctly :) - Provides RegisterMigration which should be able to decorate migrations and register them in doing so
* adds previous and next links in the sidebarCaleb Forbes Davis V2011-07-021-1/+1
| | | | | | | | Feature #401 - previous/next navigation on media pages * media.html includes a new prev_next.html template containing the links * prev_next.html calls functions added to the media model to retrieve the appropriate objects from the database, formatted with urlgen * a small change to util.py brings ASCENDING into the mix
* Documenging index utils and adjusting how remove_deprecated_indexes gets ↵Christopher Allan Webber2011-06-271-2/+17
| | | | | | | | | | arguments More specifically, we now just take a dictionary of lists, like: {'collection': ['index_identifier1', 'index_identifier2']} Previously we took something with more info like in add_new_indexes, but that extra info isn't really necessary.
* Tools to add / remove indexes from collectionsChristopher Allan Webber2011-06-271-0/+65
|
* Move InvalidId to db.utilElrond2011-06-201-0/+1
| | | | | | Instead of import InvalidId from the low level bson module, first import it in our db.util wrapper and second import it from pymongo.errors.
* Factor out most of the database connection into db/open.pyElrond2011-05-191-13/+0
| | | | | | | | I needed to split the db connection/opening into open.py, due to an import loop: - util.py needs db/util.py:ObjectId - db/util.py would need db/models.py - db/models.py needs util.py:slugify
* Renaming connect_database to connect_database_from_config and using in ↵Christopher Allan Webber2011-05-181-1/+1
| | | | from_celery
* Need to import asint for users who specify ports via config fileChristopher Allan Webber2011-05-181-0/+2
|
* Adding copyright headers and explaining why these unused imports are hereChristopher Allan Webber2011-05-181-0/+18
|
* Move ObjectId, DESCENDING to db.utilElrond2011-05-181-0/+2
| | | | | | We used to import those from pymongo and mongokit directly. We should import them from a single place. So let's try db.util for this.
* Move "connect to database" into db/util.pyElrond2011-05-181-0/+11