2114 Commits

Author SHA1 Message Date
Elrond
eace050a7d Move celery task into own task.py
Move the actual celery task from processing/__init__.py
into its own .../task.py. That way it can be imported as
needed.
2012-03-21 12:12:07 +01:00
Elrond
4bdee988b6 Turn processing.py into a submodule.
processing.py -> processing/__init__.py

This is in preparation for splitting processing a bit.
The main reason for the split is celery setup: celery needs
to be setup before even importing and importing and
subclassing some of its parts. So it's better to move the
critical parts into their own submodule and import it as
late as needed.
2012-03-21 12:11:58 +01:00
Christopher Allan Webber
8839540656 Merge remote-tracking branch 'refs/remotes/brett/bug270-lazycelery-script' 2012-03-20 23:24:43 -05:00
Brett Smith
6573573dd1 Add tests for image processing. Check filenames and image sizes.
This test helps verify that bug #261 is actually fixed.

In order to test that all the processed images are smaller, I needed to add
an image that's bigger than processing.MEDIUM_SIZE, hence bigblue.png.
2012-03-20 23:59:28 -04:00
Brett Smith
e75d4a0dd5 Make a function to generate test image filenames. 2012-03-20 23:03:11 -04:00
Brett Smith
d1f52dc776 Prefer nose assert_* methods to the assert built-in. 2012-03-20 22:40:32 -04:00
Brett Smith
c373903494 Refactor false image tests. 2012-03-20 22:36:56 -04:00
Brett Smith
c0e87ec9d2 Refactor normal upload tests.
This is nice because it means we do *all* the normal sanity tests for *all*
the normal uploads.  check_url() can be used in other tests too.
2012-03-20 22:30:57 -04:00
Brett Smith
77445d13ad Refactor MediaEntry fetches/checks into check_media(). 2012-03-20 22:16:28 -04:00
Brett Smith
31dd6013b8 Refactor data posts into one do_post function.
All the data posts in these tests had a lot of common code.  Putting all
that into a function makes it easier to write more tests (which I'll be
doing in a bit) and see what's really being tested.
2012-03-20 22:07:32 -04:00
Elrond
8fd81053b4 More standard media_data model for ascii.
ascii doesn't use media_data at all. So it needs the most
basic media_data model. Fix it to take the current form.
2012-03-20 23:55:28 +01:00
Elrond
b829595334 Create load_models().
So all models are ready when connecting to the db and so
our "db" object has all models listed on it, create a
function to load all models from the media_types, etc. Call
it in setup_database()

Problem: This gives celery warnings, because celery is
imported before being setup properly. No idea how to fix
this now. So media-type loading is excluded from
load_models for now.
2012-03-20 12:45:40 +01:00
Elrond
39fd817ab8 Import "Base" from base instead of models.
Import the "Base" class for models from db.sql.base instead
of db.sql.models.
2012-03-20 12:45:40 +01:00
Elrond
df7c405845 Disable query logging for now, so we get nicer logs
As the queries are quite verbose, disable them for now.
Reenabling them should be done in the central logging
config, which is another story for celery and bin/gmg.
2012-03-20 12:45:40 +01:00
Jakob Kramer
6b45ec1b0c 500 error because of subscripting instead of using attributes 2012-03-18 22:28:22 +01:00
Christopher Allan Webber
5f08116352 Committing extracted and compiled translations 2012-03-18 15:16:37 -05:00
Christopher Allan Webber
50fd85967f Committing present MediaGoblin translations before pushing extracted messages 2012-03-18 15:16:03 -05:00
Christopher Allan Webber
9dcd8436a9 Fixing manual tyop: MediaGoblin, not MediaGobiin (thanks gandaro!) 2012-03-18 14:39:35 -05:00
Christopher Allan Webber
94e6052375 Merge branch 'master' into derek-moore-bug405_email_notifications_for_comments
Conflicts:
	mediagoblin/db/mongo/migrations.py
2012-03-18 12:12:41 -05:00
Christopher Allan Webber
54477b4d76 Removing print statements from convert_gps_media_data migration
Kind of useful to see but... I don't think they're needed, and I'm not
super comfortable with print statements being in migrations.  Seems
semi bloated!
2012-03-18 12:07:41 -05:00
Brett Smith
176f207b63 small readability improvements in resize_image 2012-03-18 09:35:14 -04:00
Brett Smith
063670e9b4 Refactor image resize code, with better filenames (#261)
The code to make thumbnail- and medium-sized images in processing.py is
pretty similar, so I rolled that out into a separate function that we call
with different arguments as appropriate.

The new function should work identically to the old code, except it saves
images with filenames based on the original filename, like
`foobar.medium.jpg` instead of just `medium.jpg`.  This fixes bug #261.
2012-03-17 23:43:46 -04:00
Brett Smith
e4df2fc5b3 Refactor lazyserver.sh to lazystarter.sh and provide lazycelery.sh (#270)
Bug #270 asks for a lazycelery.sh script much like lazyserver.sh.  Rather
than duplicate the code, I consolidated them into a single script,
lazystarter.sh.  The script reconfigures itself a bit, and runs a
particular server, based on the name that's used to call it, but no matter
what it uses the same code to offer help and find configuration files and
server launchers.  Hopefully this will make it easy to add other
features/fix bugs as needed in the future, and have them stay in sync.
2012-03-17 22:33:08 -04:00
Elrond
7bf819a995 Let convert_mongo_to_sql add Migration Records
The mongosql tool is really dumping directly into the sql
database and is trying not to use too much logic that might
change later.

So this means, it needs to create the migration records on
its own!
So add a bunch of records with version=0.
2012-03-17 23:45:29 +01:00
Christopher Allan Webber
16fca040d5 Merge remote-tracking branch 'brett/bug264-delete-comments-with-media' 2012-03-17 17:18:15 -05:00
Christopher Allan Webber
2011f2d89e Merge branch 'master' of gitorious.org:mediagoblin/mediagoblin 2012-03-17 17:09:26 -05:00
Christopher Allan Webber
9e55431143 mongo->sql conversion script now runs mongo migrations first, just in case 2012-03-17 17:08:46 -05:00
Jef van Schendel
327a1bb279 Remove sidedata class from html pages 2012-03-17 22:58:33 +01:00
Christopher Allan Webber
4a250dbdde Also ignore the /share/ directory 2012-03-17 16:57:18 -05:00
Jef van Schendel
4c417c59b3 Small styling change for sidebar data 2012-03-17 22:56:25 +01:00
Christopher Allan Webber
2f5ce68c6c Make mediagoblin SQL models all use a consistent table naming scheme 2012-03-17 16:56:23 -05:00
Brett Smith
a0a7f87f62 When media is deleted, delete associated comments too.
The actual code is just a simple for loop; there might be a better
implementation but this is a fine start.  I also extended test_delete to
check this too.
2012-03-17 17:53:00 -04:00
Christopher Allan Webber
431811eb36 Mongosql imports made celery get set up before we wanted it via ./bin/gmg commands
Just moved the import into the actual function.  That resolved the issue!
2012-03-17 12:31:11 -05:00
Elrond
416b439fc8 More/better translation.
- Try to preserve some translations (somehow).
- Mark "Tagged with" again for translation.
- Do not translate the empty string
2012-03-17 13:18:43 +01:00
Jef van Schendel
7e5a5acd5a Small formatting changes to footer text. 2012-03-16 23:05:30 +01:00
Elrond
07163593ee Create function to search media by slug.
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.
2012-03-16 21:20:14 +01:00
Elrond
d8409c26a0 Fix for mongo.
pymongo does not rewind a cursor after leaving a for loop.
So let us do it by hand. Well.
2012-03-16 21:20:14 +01:00
Elrond
1eff10fa0f More efficient first element fetching and Dot-Notation.
_get_tag_name_from_entries:
1) Replace:
     if q.count():
       elem = q[0]
   by:
     for element in q:
       ...
       break

   this doesn't do two db queries but only one.

2) And another dose of Dot-Notation as usual.
2012-03-16 21:20:14 +01:00
Elrond
1b4d9edaef Fix _get_tag_name_from_entries().
Replace == by =.
2012-03-16 21:19:25 +01:00
Derek Moore
bf0f67ad65 Added wants_comment_notification to sql model 2012-03-15 17:25:38 -07:00
Derek Moore
252eaf21d5 These are changes for issue #405, add email comment notification. 2012-03-15 16:38:56 -07:00
Bassam
0f8221dca4 fix for ticket #404 2012-03-15 12:13:44 -04:00
Elrond
497d927983 Fix uploading of images (sql: media_data, exif).
When uploading a new image the processing code wants to set
the media_data['exif'] part. As exif is not yet in sql,
there is no way to make this work now. So the workaround is
to check for "no row exists yet" and just ignore exif.
2012-03-15 12:38:09 +01:00
Elrond
729424befd Fix media display for no media_data row in sql.
If there is no media_data row for the current media (for
whatever reason, there might be good ones), let
MediaEntry.media_data not raise an exception but just
return None.

The exif display part now handles this by checking whether
.media_data.exif is defined (None has no attribute exif, so
it's undefined, all fine).
2012-03-15 12:35:58 +01:00
Christopher Allan Webber
007ac2e720 Implemented the MediaEntry .media_data type fields for SQL 2012-03-14 18:28:06 -05:00
Christopher Allan Webber
956335c839 Removing an unnecessary line of whitespace AND crediting Hugo Boyer for the ipython code!
Thanks Hugo Boyer!  I forgot to credit you in my last commit.
2012-03-14 16:03:09 -05:00
Christopher Allan Webber
d87ed21ac4 Merge branch 'master' of gitorious.org:mediagoblin/mediagoblin 2012-03-14 16:00:53 -05:00
Christopher Allan Webber
0e93443f59 ipython support in ./bin/gmg shell! 2012-03-14 16:00:34 -05:00
Elrond
36ccc57bea Add gps_altitude and gps_direction to image media_data. 2012-03-14 21:17:50 +01:00
Elrond
28306810c5 Convert (gps) image media_data.
Add mongo_to_sql convert part for converting the media_data
for images. This currently drops the exif data and thus
only converts gps data.
2012-03-14 21:17:07 +01:00