| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
After a bit of discussion, we decided to drop the
pre-rendered html from the database and render it on
the fly.
In another step, we will use some proper caching method to
cache this stuff.
This commit affects the MediaComment.content_html part.
|
|
|
|
|
|
|
|
|
|
|
| |
After a bit of discussion, we decided to drop the
pre-rendered html from the database and render it on
the fly.
In another step, we will use some proper caching method to
cache this stuff.
This commit affects the MediaEntry.description_html part.
|
|
|
|
|
|
|
|
|
|
|
| |
After a bit of discussion, we decided to drop the
pre-rendered html from the database and render it on
the fly.
In another step, we will use some proper caching method to
cache this stuff.
This commit affects the User.bio_html part.
|
|
|
|
|
|
|
|
| |
Many thanks go to Svavar Kjarrval who has taken a deeper
look at our current sql db design and made a bunch of
suggestions. The suggestions are currently put as TODO
items in the docstrings. This way we can keep track of
them directly where we need it.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
- Add default for User.email_verified
- Add default for MediaEntry.state
- Let PathTupleWithSlashes store [] as "NULL",
but not handling the reverse properly yet!
- Add _id alias field to MediaEntry and MediaComment
|
|
|
|
|
|
|
|
|
|
|
| |
These changes allow all of the rest of the code to use tags
in sql as they were used on mongo. It's not efficient at
all, as changing tags usually means to remove all old tags
and adding all new.
The only problem here is: Old slugs for tags are not
removed, because they're shared across all MediaTags and
dropping orphans is not always easy.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The upcoming SQL database will allow having media without a
slug again. This might especially be useful for API
support, where the uploaded image (media) does not have
*any* information to generate a slug from.
This code change mostly allows the sql backend to have no
slug in its model and improves some parts to properly
handle that.
It specifically does not have any web frontend support to
edit/create MediaEntries with no slug.
|
|
|
|
| |
The base class of all models "Base" should be in base.py.
|
|
|
|
| |
Uses complete sqlalchemy syntax now.
|
|
|
|
|
| |
Using proper sqlalchemy syntax instead of the emulated
mongo one.
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| | |
Nearly all the sql files missed a copyright header.
So added it!
And while there fixed a few pep8 things.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A custom query class allows to add more methods on
queries (read: "cursors").
This custom query class especially adds a .sort with a
calling convention exactly like the mongo one.
Makes a lot of existing code happy!
|
| |
| |
| |
| | |
translation tags to license template.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
sql/fake.py contains some fake classes and functions to
calm the rest of the code base. Or provide super minimal
implementations.
Currently:
- ObjectId "class": It's a function mostly doing
int(first_arg) to convert string primary keys into
integer primary keys.
- InvalidId exception
- DESCENING "constant"
|
| |
| |
| |
| | |
stuff from models
|
| | |
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- This adds a new SQL table field type for path tuples.
They're stored as '/' separated unicode strings.
- Uses it to implement a MediaFile table.
- Add relationship and proxy fields on MediaEntry to give a
nice media_files "view" there.
- Let the converter fill the MediaFile.
|
| |
| |
| |
| |
| | |
Move changes from mongo/models:url_for_self back into
mixin:url_for_self.
|
| |\
| | |
| | |
| | |
| | | |
Conflicts:
mediagoblin/db/mongo/models.py
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
A bunch of functions on the db objects are really more like
"utility functions": They could live outside the classes
and be called "by hand" passing the appropiate reference.
They usually only use the public API of the object and
rarely use database related stuff.
Goals:
- First, simple: Share the code with the SQL objects, so
that the code doesn't need to be duplicated.
- Second, it might unclutter the db models and make them
more into "model only" stuff.
- Doesn't really hurt.
|
| |/
| |
| |
| | |
the html version of each entry)
|
| |
| |
| |
| |
| |
| | |
Inside the mongo db backend, use the mongo
MigrationManager. This is hopefully the last reference to
the generic MigrationManager reference on db.util.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
1. Use the new setup_connection_and_db_from_config in the
sql backend.
2. Use sql and mongo specific functions wherever
appropiate instead of the generic "db.X" one. This makes
the converter more indepedent of the current backend
choice.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When initializing the database connection the current mongo
based setup checked for new migrations and warned about
them. This was mongo specific so factor'd it out into a
more generic check_db_migrations_current function in the
mongo backend.
Also created a dummy one in the sql backend.
|
| |
| |
| |
| |
| |
| |
| |
| | |
This is a shortcut to adding the object to a session (if
needed) and giving a commit on the session.
In reality, calling code should probably utilize the
session on its own and call commit in an appropiate place.
|
| |
| |
| |
| |
| |
| | |
Some parts of the code like to call .get("somefield") on
the db objects. It's easy to support this on sqlalchemy
based objects, so lets do it.
|
| |
| |
| |
| |
| |
| | |
MediaEntry now has a get_uploader (property) loading the
appropiate User object for the MediaEntry (and caches it).
MediaComment has the same for author as get_author.
|
| |
| |
| |
| |
| |
| |
| |
| | |
While creating the new SQL model, the "state" field of
MediaEntry was left out. Currently using a plain unicode
string for it.
Maybe should use sqlalchemy.types.Enum?
|
| |
| |
| |
| |
| |
| |
| |
| | |
So that the old code can access the primary key still as
"._id".
Quite simple Python Descriptor thing.
Very generic.
|
| |
| |
| |
| |
| |
| |
| | |
sqlalchemy gives autoloading (hopefully caching) link to
other objects as properties. So turn get_uploader on the
current mongo based stuff into a property to ease
transition.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Replace
urlgen('ID', user=media.get_uploader().username, media=media.*)
by
media.url_for_self(urlgen)
in a few places.
It's just a lot nicer!
|
| |
| |
| |
| |
| |
| |
| |
| | |
Instead of creating the email verication key on the db
model as a default for the field, create it in the
registration view.
Now all verification key generation is only in
auth/views.py!
|
| | |
|
| |
| |
| |
| | |
And create a _fix_query_dict which converts '_id' to 'id'.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
1) MediaComment's author method conflicts with the author
field. So rename it to get_author.
2) Turn it from a normal function into a python property.
That means you call it by ".get_author" not by
".get_author()". This is exactly what sqlalchemy gives
us free of charge.
|
| |
| |
| |
| |
| | |
To my surprise, there was only ONE reference to models.py.
From open.py.
|
| |
| |
| |
| | |
And change references.
|
| |
| |
| |
| |
| | |
- Change some reference
- Provide a wrapper db/util.py
|
| |
| |
| |
| | |
And change references (one!).
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Starting to move the mongo specific stuff into db/mongo.
And create thin "from db.mongo.Y import z" wrappers in
db/Y.py.
Why?
1) Will make it lots easier to switch to sql for
testing/developing.
2) The mongo stuff needs to stay around after moving to
sql, because the converter needs it.
|
| |
| |
| |
| |
| |
| |
| |
| | |
In trying to ease the migration to SQL, created an
interface to sqlalchemy that looks a lot like the interface
that is currently in use.
*WARNING* Work in progress
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is just a start at a Migration tool from Mongo to SQL.
It fills all currently available SQL models with data from
MongoDB. A few fields in the SQL tables are left out,
because some data format migrations are needed (notably:
queue_file_name).
This thing lives in mediagoblin/db/sql/convert.py because
it has a lot of stuff hardcoded and is not, repeat not for
end users!
Hard coded:
- output database: ./mediagoblin.db (sqlite)
- Mediagoblin config: ./mediagoblin.ini
|