197 Commits

Author SHA1 Message Date
Elrond
7fb419ddd2 Create new session system for piwigo plugin.
Using the brand new itsdangerous sessions to power the
sessions for piwigo.
The real point is: Clients want to have the session in a
"pwg_id" cookie and don't accept any other cookie name.
2013-05-09 00:21:03 +02:00
Elrond
c1df8d1963 piwigo: Add .images.add including form handling.
To make things a bit easier, switch to WTForms
for validating the received data.
2013-05-09 00:15:11 +02:00
Elrond
180a008100 piwigo: Remove possibly_add_cookie.
This one was a fake thing to make clients happy.
Real sessions coming sonn.
2013-05-09 00:14:05 +02:00
Christopher Allan Webber
230b5eb2eb Fixing API setup with new plugin "config spec" world
It shouldn't reference the config until in the setup_plugin() method,
else there's a race condition.
2013-05-08 15:20:27 -05:00
Joar Wandborg
1422cab669 Removed unused imports in httpapiauth 2013-05-05 22:24:34 +02:00
Aditi Mittal
665b9c420a Fix-bug-667-Use-lazy_pass_to_ugettext-for-forms. 2013-04-24 16:40:29 -05:00
Elrond
90d7de255a piwigo: Send NotImplemented for unknown methods.
That's somewhat, what piwigo does.
2013-04-18 16:14:16 +02:00
Elrond
f6f557696d Use check_file_field in pwg_images_addSimple. 2013-04-18 16:14:16 +02:00
Elrond
bc92ff9d3c Start to use six for basestring.
six allows us to smoothly get more forward compatible with
py3.  The idea is to change things over to use six, when/if
we feel a need for it.
2013-04-18 16:14:16 +02:00
Joar Wandborg
c121a7d3d0 OAuth: Support refresh tokens, etc
Initially I was going to write a failing test for refresh tokens. Thus
this fix includes an orphaned 'expect_failure' method in test utils.

I ended up writing support for OAuth refresh tokens, as well as a lot of
cleanup (hopefully) in the OAuth plugin code.

**Rebase**: While waiting for this stuff to be merged, the testing
framework changed, it comes with batteries included regarding fails.
Removed legacy nosetest helper.

Also added a lot of backref=backref([...], cascade='all, delete-orphan')
2013-04-06 22:17:27 +02:00
Elrond
4924b93bac Merge remote-tracking branch 'JDShu/649_use_form_data_field'
* JDShu/649_use_form_data_field:
  Use WTForms data field in user_pages/views.py
  Use WTForms data field in auth/views.py
  auth: whitespace cleanup in views.py
  Use WTForms data field in plugins/oauth/views.py
  Use WTForms data field in submit/views.py
  Use WTForms data field in edit/views.py
2013-03-30 14:42:45 +01:00
Christopher Allan Webber
047d8d5871 Merge branch 'master' of gitorious.org:mediagoblin/mediagoblin 2013-03-29 08:09:36 -05:00
Christopher Allan Webber
6c6e9911f5 Warning that raven plugin is somewhat experimental! 2013-03-29 08:09:26 -05:00
Elrond
2ef2f46e73 Refactor file field checking.
When uploading, the file field needs some checks, it seems.
So refactor them into check_file_field and use around.
2013-03-29 12:01:23 +01:00
Hans Lo
29f523e1db Use WTForms data field in plugins/oauth/views.py 2013-03-28 00:08:18 -04:00
Elrond
9924cd0fb6 piwigo: Fix pwg_getversion
This one needs to return just "2.5.0 (Mediagoblin)" instead
of "Piwigo 2...".
2013-03-26 19:23:22 +01:00
Elrond
79f87b975e piwigo: Start at pwg.images.addSimple.
Without a session and a logged in user, this can't go much
further.

Misses check for the file upload field.
Need refactored test tool for this.
2013-03-26 19:19:32 +01:00
Elrond
398d384137 piwigo start at pwg.images.addChunk.
This function receives part of an upload. Does most
parameter validation, but does not safe the data anywhere
for now.

Also fake pwg.images.exist
2013-03-21 09:18:07 +01:00
Elrond
cf0816c182 piwigo: Add session.getStatus, improve categories.getList
- pwg.session.getStatus returns the current user as
  "fake_user".  When we have a session, we'll return
  something better.

- pwg.categories.getList add a name and the parent id for
  its one and only "collection".

- Improve logging a bit.
2013-03-21 09:18:07 +01:00
Elrond
dc7c26f355 piwigo: Sent a fake cookie.
shotwell needs a pwg_id cookie to continue.
And really, it's the only cookie it supports, so in the
long run, we need to send a proper session cookie as
pwg_id.
2013-03-21 09:04:37 +01:00
Elrond
1330abf722 Add warning README.rst and fix pep8. 2013-03-19 23:20:46 +01:00
Elrond
4234fffafa piwigo: Move tool functions into tools.py 2013-03-19 21:58:28 +01:00
Elrond
e4e5948c58 Start at pwg.categories.getList and improve xml output.
- The xml formatting is now in the main function.
- Add PwgNamedArray to have named lists in xml output.
- Remove gmg.test method
2013-03-19 21:58:06 +01:00
Elrond
bd3bc0446c piwigo: start xml response encoding, more (fake) methods. 2013-03-19 21:55:31 +01:00
Elrond
427beb08af Starting a piwigo api plugin.
This one just puts up the basic endpoint, some
infrastructure and a fake login method.

Lots more needed.
2013-03-19 21:55:31 +01:00
Christopher Allan Webber
81f73707a6 Providing warning to users about instability of OAuth/API 2013-03-08 14:38:55 -06:00
Joar Wandborg
f3f530286f Updated raven plugin
- Added wrap_wsgi, celery_setup, celery_logging_setup hooks
- Updated raven plugin docs
- Updated production considerations docs
- Added raven logging setup
2013-03-03 02:32:03 +01:00
Joar Wandborg
40ef3f5e05 plugin/raven: Fix paster's celery config issue
Check for CELERY_CONFIG_MODULE before we import raven.contrib.celery. It
seems that the import otherwise sets up the celery client before we get
to pass it our mediagoblin-specific settings.
2013-03-03 00:46:05 +01:00
Joar Wandborg
32174bedc1 Removed stray ) 2013-03-03 00:46:05 +01:00
Joar Wandborg
dee408291a Removed PLUGIN_DIR from raven 2013-03-03 00:46:05 +01:00
Joar Wandborg
0c1ae3518e Don't look for the oauth config in raven plugin 2013-03-03 00:46:05 +01:00
Joar Wandborg
b9c5c97238 Refactored raven plugin 2013-03-03 00:46:05 +01:00
Joar Wandborg
3fbba1af82 Added raven plugin 2013-03-03 00:46:05 +01:00
Joar Wandborg
77c85224b1 Fixed hidden fields in oauth client authorization
Removed the translation marking and passed in empty strings to avoid
WTForms automagically creating the labels from the field names (i.e.
client_id => 'Client Id').
2013-03-02 23:42:03 +01:00
Christopher Allan Webber
cac17c156b Renaming "extrahead" template hooks to "head".
As Elrond points out, the "extra" is implied by it being a hook!

This commit sponsored by Andrew Fustini.  Thanks, Drew!
2013-02-24 12:42:17 -06:00
Runar Petursson
9b2cd962af plugins/api: fix for cross origin requests
The response headers were never getting set because of a bug in the 7c552c0
commit.  This expands the loop into a more readable form and results in the
headers getting set.
2013-02-20 23:41:36 +01:00
Elrond
c9abf931cb issue 615: config geolocation_map_visible gone.
The template in the geolocation plugin still used the old
config option. Just remove that. To enable it, you enable
the plugin. No need for extra config.

Tested by manwesulimo2004 (via IRC).
2013-02-02 20:40:19 +01:00
Christopher Allan Webber
a3f811a6e8 Geolocation stuff, including including templates seems to be working-ish
- I'm having trouble seeing if the geolocation stuff actually works,
   but plugins are included
 - including a list of template hooks works, however the macro to
   include them does not, so it's kinda verbose
2013-01-30 13:22:18 -06:00
Christopher Allan Webber
1c2d01ae3b Very start of plugin hooks and openstreetmap pluginification
- Added start of template hook code to pluginapi.py
 - Started to break openstreetmap into plugin; moved templates
 - Added plugin hooks in media and image media templates

... almost certainly, none of this works yet. :)
2013-01-30 13:22:18 -06:00
Sebastian Spaeth
c7b3d070b6 Don't pass request into run_process_media
People(tm) want to start run_process_media from the CLI and might not
have a request object handy. So pass in the feed_url into
run_process_media rather than the request object and allow the feed url
to be empty (resulting in no PuSH notification at all then).

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2013-01-15 15:03:00 +01:00
Sebastian Spaeth
2cfffd5ed8 Make PuSHing the Pubhubsubbub server an async task (#436, #585)
Notifying the PuSH servers had 3 problems. 

1) it was done immediately after sending of the processing task to celery. So if celery was run in a separate
process we would notify the PuSH servers before the new media was processed/
visible. (#436)

2) Notification code was called in submit/views.py, so submitting via the
   API never resulted in notifications. (#585)

3) If Notifying the PuSH server failed, we would never retry.

The solution was to make the PuSH notification an asynchronous subtask. This
way: 1) it will only be called once async processing has finished, 2) it
is in the main processing code path, so even API calls will result in
notifications, and 3) We retry 3 times in case of failure before giving up.
If the server is in a separate process, we will wait 3x 2 minutes before
retrying the notification.

The only downside is that the celery server needs to have access to the internet
to ping the PuSH server. If that is a problem, we need to make the task belong
to a special group of celery servers that has access to the internet.

As a side effect, I believe I removed the limitation that prevented us from
upgrading celery.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2013-01-15 14:53:08 +01:00
Elrond
c130e3ee79 Move db.sql.migration_tools to db.migration_tools.
Follow the new trend.
2013-01-08 22:50:01 +01:00
Elrond
a050e776c6 Move all the migration tools into new migration_tools.py
Factor all the migration related stuff out into a new
.db.sql.migration_tools.
First we don't have to load this module for our normal
server.
Second it makes all the import dependencies a little more
cleaner.
2013-01-08 22:50:01 +01:00
Sebastian Spaeth
39dc3bf8db Mv db.sql.base to db.base
This concludes the db.sql.* -> db.* move. Our db abstraction layer is
sqlalchemy, so there is no need to a separate db.sql.* hierarchy.

All tests have been run for each of the commit series to make sure
everything works at every step.
2013-01-07 13:42:32 +01:00
Sebastian Spaeth
b0c8328e54 Move db.sql.models* to db.models* 2013-01-07 11:44:29 +01:00
Sebastian Spaeth
1e46dc2537 Move db.sql.util to db.util
Now that sqlalchemy is providing the database abstractions, there is no
need to hide everything in db.sql. sub-modules. It complicates the code
and provides a futher layer of indirection.

Move the db.sql.util.py to db.util.py and adapt the importers.
2013-01-07 11:31:56 +01:00
Joar Wandborg
78fa73bcd5 Made api_test use @require_active_login 2013-01-02 20:05:07 +01:00
Elrond
b228d89715 prepare_queue_task: Take app not request.
First rename prepare_entry to prepare_queue_task, because
this is really more like what this thing does.

Thanks to Velmont for noting that we do not need a request
in here, but an "app" is good enough. Which means, that
this stuff can be called from tool scripts too.
2012-12-26 23:42:26 +01:00
Elrond
01986008f6 upload refactor: Use prepare_entry in api. 2012-12-26 23:42:26 +01:00
Elrond
37f90b435d Use run_process_media in the api.
Now refactor in the api. Start with run_process_media.
2012-12-26 23:42:26 +01:00