Commit graph

189 commits

Author SHA1 Message Date
Tyson Clugg
be93d5e1e8 Pylint cleanups. 2015-10-28 13:30:58 +11:00
Tyson Clugg
4c0fd40ebd Fix bug causing some subscription queries to use inefficient SQL. 2015-10-14 02:59:02 +11:00
Tyson Clugg
27c270f40f Fixes #6 (again) -- Python 3 style exception handling. 2015-10-13 23:44:15 +11:00
Tyson Clugg
80238bc785 Make the SQL for subscriptions much faster to run.
The PostgreSQL query planner knows to short-circuit some operators such
as IN or ANY such that `foo_id IN (SELECT foo.id FROM foo WHERE ...)`
doesn't need to perform a full table scan on foo.

This change ensures that `user_rel` WHERE clauses use the `IN` operator
to take advantage of the greatly improved performance.
2015-10-13 23:13:41 +11:00
Tyson Clugg
b80e50a6ac Improvements to error/exception handling. 2015-10-13 11:39:20 +11:00
Tyson Clugg
2aa21c7a27 Warn if many TX chunks are waiting (stalled?) 2015-10-13 11:36:05 +11:00
Tyson Clugg
91a1b4a3db Bugfix thread locals setup when opening WebSocket. 2015-10-13 11:18:24 +11:00
Tyson Clugg
0bbf5ac10c Add missing import for Python 2 print(). 2015-10-13 11:13:59 +11:00
Tyson Clugg
b14b2a427e New setting DDP_API_ENDPOINT_DECORATORS.
Takes a list of dotted import paths to decorators which are applied to API
endpoints.  For example, enable New Relic instrumentation with the following:

```
DDP_API_ENDPOINT_DECORATORS = ['newrelic.agent.background_task']
```
2015-10-13 11:05:02 +11:00
Tyson Clugg
397e044ddd Work towards #16 -- Use psycopg2cffi compatibility if psycopg2 not installed. 2015-10-08 11:58:42 +11:00
Tyson Clugg
73465d6ed4 Fixed #7 -- Warn if using DB engines other than psycopg2. 2015-10-08 11:37:03 +11:00
Tyson Clugg
05e3356b93 Pass all attributes from logging.LogRecord via dddp.logs collection. 2015-09-25 11:32:04 +10:00
Tyson Clugg
f15efc0930 Use select_related() and resultant cached relational fields to speed up Colleciton.serialize(). 2015-09-25 11:30:48 +10:00
Tyson Clugg
33052f4835 Fix bug in get_meteor_ids() which caused extra database hits. 2015-09-25 11:29:38 +10:00
Tyson Clugg
cefe6fe62d Account security tokens are now calculated for each minute allowing for finer grained token expiry. 2015-09-22 18:11:45 +10:00
Tyson Clugg
56c850948f Update dddp/test/meteor_todos/ app to Meteor 1.2.0 (still works fine with older versions though). 2015-09-22 17:01:18 +10:00
Tyson Clugg
81824e5bfe Fix dddp.test.test_project URL config and options for MiniMongo collections. 2015-09-22 17:00:03 +10:00
Tyson Clugg
9cf2ec3a0b Correctly handle serving app content from the root path of a domain. 2015-09-22 16:58:19 +10:00
Tyson Clugg
d7ea54539c Show API endpoints when dddp command run with verbosity above 1. 2015-09-22 11:55:35 +10:00
Tyson Clugg
5e545ee7c2 Stop printing path to stderr by default when handling GET on Meteor URLs. 2015-09-22 11:51:06 +10:00
Tyson Clugg
9a9e119c36 Fix error in logging call during exception handling. 2015-09-22 11:49:56 +10:00
Tyson Clugg
ef414f50c4 Don't rely on HTTP_REFERER header which may not be present. 2015-09-22 11:48:24 +10:00
Tyson Clugg
7cf4bf5c8c Fix bug in serialization of logging.LogRecord to show formatted message. 2015-09-22 11:46:50 +10:00
Tyson Clugg
2264ddbdc2 Abstract DDPLauncher out from dddp.main.serve to permit use from other contexts. 2015-09-18 17:47:26 +10:00
Tyson Clugg
d03b259226 Allow Ctrl-C (Break) handling at any time, only run async DB connection when PostgresGreenlet is running. 2015-09-18 17:47:26 +10:00
Tyson Clugg
f756ec445f Include name and levelno attributes in DDP emitted log records. 2015-09-18 17:43:23 +10:00
Tyson Clugg
61e5d8dcf8 Don't attempt to monkey patch more than once. 2015-09-18 17:42:41 +10:00
Tyson Clugg
da70e10857 Include exception info in logger.error logging call. 2015-09-18 17:42:11 +10:00
Tyson Clugg
282fe36b7e Set blank=True on AleaIdField, allowing adding items without inventing IDs yourself. 2015-08-27 14:25:26 +10:00
Tyson Clugg
7c54f4c324 Added migration for changed field defaults on Connection.connection_id. 2015-08-13 09:47:16 +10:00
Tyson Clugg
04ef1ab8a0 More aggressive searching for local AleaIdField(unique=True) when translating between meteor/object identifiers. 2015-08-13 09:46:31 +10:00
Tyson Clugg
489175d9a9 Added helper for migrations involving AleaIdField to populate fields from ObjectMapping table. 2015-08-13 09:44:45 +10:00
Tyson Clugg
b32e5aa547 Add missing imports 2015-08-13 09:43:38 +10:00
Tyson Clugg
4a5988854f Merge branch 'develop' into feature/AleaIdField_as_primary_key 2015-08-12 12:03:16 +10:00
Tyson Clugg
f02df498a2 Remove console noise from logging handler init. 2015-08-12 12:02:56 +10:00
Tyson Clugg
93abd0a6b7 Merge branch 'develop' into feature/AleaIdField_as_primary_key
Conflicts:
	dddp/server/views.py
	dddp/views.py
2015-08-11 15:36:54 +10:00
Tyson Clugg
e5784ac4ca Drop dddp.server app, dddp.server.views moved to dddp.views 2015-08-11 14:55:43 +10:00
Tyson Clugg
00b1432974 Allow support for multiple meteor apps in a single django-ddp enabled project by reading METEOR_STAR_JSON as part of view init instead of app ready. 2015-08-11 09:49:12 +10:00
Tyson Clugg
5939d47af6 Normalise paths in dddp.server.views before comparison. 2015-08-11 09:48:00 +10:00
Tyson Clugg
7663405702 Honour AleaIdField(max_length=...) when generating IDs. 2015-08-11 09:44:54 +10:00
Tyson Clugg
7083c5c92f Chunked payload for NOTIFY/LISTEN to get around 8KB limit on payload. 2015-08-10 18:47:04 +10:00
Tyson Clugg
5ec27b669c Add BackdoorServer support to dddp command, add "Logs" publication. 2015-08-10 16:34:39 +10:00
Tyson Clugg
6ea0e71a74 Bugfix dddp.accounts forgot_password feature. 2015-07-28 14:04:11 +10:00
Tyson Clugg
8d340c022d Merge branch 'develop' into feature/AleaIdField_as_primary_key 2015-07-23 11:07:57 +10:00
Tyson Clugg
aa89ead1ed Allow support for multiple meteor apps in a single django-ddp enabled project by reading METEOR_STAR_JSON as part of view init instead of app ready. 2015-07-23 11:07:20 +10:00
Tyson Clugg
d7dd9f2bb5 Merge branch 'develop' into feature/AleaIdField_as_primary_key 2015-07-23 08:53:59 +10:00
Tyson Clugg
d762fa45c4 Updated error handling to ensure error reply to method messages when appropriate. 2015-07-22 10:33:21 +10:00
Tyson Clugg
e7b38b89db Stop running request middleware upon connection.
This change deserves a more thorough explanation.  All currently
released versions of Django are based around the concept of receiving a
request and immediately dispatching a response.

WebSocket connections don't follow this convention, and the `request` hangs
around for long periods of time.  As such, things like `request.user` don't
really make sense as a user may login, then logout, then login again all
within the life of a single request.

Given that the concepts applied in Django are based upon a premise that
doesn't hold true for WebSockets (that a request is short-lived), it
doesn't make sense to apply those concepts in django-ddp.
2015-07-21 21:24:14 +10:00
Tyson Clugg
d358ce413a Never assume this.user_id is available. 2015-07-21 21:23:37 +10:00
Tyson Clugg
305b00bc3d Add ThreadLocal factory for this.user which is retrieved from the datbase on demand. 2015-07-21 21:19:55 +10:00
Tyson Clugg
5088c0016d Move thread local factories out of ThreadLocal so other modules may add their own factories. 2015-07-21 21:17:23 +10:00
Tyson Clugg
36199d27c1 Call ready() for each registered API provider as part of AppConfig.ready(). 2015-07-21 19:17:21 +10:00
Tyson Clugg
a462fc52b6 Refactor dddp.accounts.ddp to not use this.request.user or any of django.contrib.sessions. 2015-07-21 19:00:07 +10:00
Tyson Clugg
adf8a5b9c3 Some pylint cleanups to dddp.accounts.ddp module. 2015-07-21 18:53:49 +10:00
Tyson Clugg
b059fe37da Allow silent sub/unsub to support Meteor null publications. 2015-07-21 09:55:55 +10:00
Tyson Clugg
4608996e9f Fix issue with incorrect ordering of messages during login/logout. 2015-07-18 14:09:50 +10:00
Tyson Clugg
8eb2a3d492 Add short_description to get_meteor_id helper for use in ModelAdmin list_display. 2015-07-17 17:49:23 +10:00
Tyson Clugg
797e10e08c Add ObjectMappingMixin using GenericRelation back to ObjectMapping model. 2015-07-17 17:48:25 +10:00
Tyson Clugg
f43097a9ca Add dddp.models.get_object_ids helper function. 2015-07-17 17:46:46 +10:00
Tyson Clugg
a9856294c0 Simplify ModelAdmin registration. 2015-07-16 16:26:53 +10:00
Tyson Clugg
01f6d9eed4 Merge branch 'develop' into feature/AleaIdField_as_primary_key 2015-07-16 09:06:48 +10:00
Tyson Clugg
244567c3ba Bugfix /app.model/schema helper method to work with more model field types. 2015-07-16 08:46:12 +10:00
Tyson Clugg
43b35a12ce Add models and various shortcuts to allow for AleaIdField with primary_key=True. 2015-07-14 09:31:42 +10:00
Tyson Clugg
cb46caf9ff Fix bug in post login/logout subscription handling. 2015-07-14 09:22:27 +10:00
Tyson Clugg
781ea8e7a2 Pylint cleanups. 2015-07-09 09:19:13 +10:00
Tyson Clugg
dfd52ebb32 Cleanup Collection.user_ids_for_object(obj) method.
* Removed `include_superusers` argument, replaced with class level `always_allow_superusers` attribute.
* Removed unused `base_qs` argument.
* Don't test for obj being a primary key when running query since obj is assumed to be an object in the prior lines of code anyway.
2015-07-09 08:52:10 +10:00
Tyson Clugg
b059dcbeb0 Fix bug in Accounts.forgotPassword implementation. 2015-07-08 11:55:41 +10:00
Tyson Clugg
fe13aac602 Match return values for Accounts.changePassword and Accounts.changePassword methods. 2015-07-08 11:33:18 +10:00
Yan
8eb293f090 update changePassword 2015-07-08 11:15:32 +10:00
Tyson Clugg
92b42e365b Update hash method in dddp.accounts to bind hash tokens to specified purposes. 2015-07-07 17:40:07 +10:00
Yan
0076b729e4 fix incorrect params in reset_password 2015-07-07 14:22:55 +10:00
Tyson Clugg
ebc8be6e3b Publish user.permissions from dddp.accounts. 2015-07-03 11:49:21 +10:00
Tyson Clugg
b73e29edae Use mimetypes module to correctly guess mime types for Meteor files being served. 2015-06-29 18:19:07 +10:00
Tyson Clugg
35b8b001aa Include ROOT_URL_PATH_PREFIX in ROOT_URL when serving Meteor build files. 2015-06-29 12:01:47 +10:00
Tyson Clugg
fd0cd2023a Use HTTPS for DDP URL if settings.SECURE_SSL_REDIRECT is set. 2015-06-22 04:14:34 +10:00
Tyson Clugg
2f69881e14 Handle django.contrib.postgres.fields.ArrayField in serialization. 2015-06-16 17:50:10 +10:00
Tyson Clugg
34f862bb3d Pylint cleanup. 2015-06-16 17:49:39 +10:00
Tyson Clugg
07ccc014bc Fix array aggregate for Django 1.8 2015-06-14 03:31:27 +10:00
Tyson Clugg
9b18e4833a Remove unused imports from AppConfig module. 2015-06-14 00:20:39 +10:00
Tyson Clugg
16e48e50be Don't barf on multiple invocations of greenify(). 2015-06-14 00:08:13 +10:00
Tyson Clugg
2ad5e28452 WIP on Django 1.8 compatibility. 2015-06-12 23:08:27 +10:00
Tyson Clugg
3cf47a928f Remove editor cruft from repo. 2015-06-10 17:48:29 +10:00
Tyson Clugg
a680a5a643 Add dddp.server Django app to serve Meteor app files. 2015-06-05 09:51:54 +10:00
Tyson Clugg
2cfb3ebe12 Pylint: reduce number of variables in method. 2015-06-05 09:38:15 +10:00
Tyson Clugg
65927e20e6 Don't emit change messages for migrations/ddp apps. 2015-06-05 09:37:36 +10:00
Tyson Clugg
1e000d2892 Show method input params after traceback if exception occurs. 2015-06-05 09:36:49 +10:00
Tyson Clugg
b8bf33a992 Remove shadown method definition. 2015-06-05 09:36:12 +10:00
Tyson Clugg
f02fba6d9f Refactor serialization to imporove performance (less DB queries) and add support for auth updating subscriptions. 2015-05-28 10:53:29 +10:00
Tyson Clugg
8327aac633 Use OrderedDict for geventwebsocket.Resource spec so geventwebsockets>=0.9.4 doesn't complain. 2015-05-27 15:16:07 +10:00
Tyson Clugg
a8b0883a39 Support optional on M2M fields with blank=True for schema generation. 2015-05-27 14:31:23 +10:00
Tyson Clugg
f5f127e9ba Check order of added/changed when emitting WebSocket frames, don't try to emit removed when client doesn't have the item. 2015-05-27 14:28:30 +10:00
Tyson Clugg
fa51d89575 Fix order of added/changed messages by deferring id checking until emitting WebSocket frames. 2015-05-27 12:48:16 +10:00
Tyson Clugg
8252a1ce68 Move test projects into path that can be imported post install. 2015-05-27 08:55:46 +10:00
Tyson Clugg
469b3cc901 Add support for SSL options and --settings=SETTINGS arg in dddp tool. 2015-05-27 08:53:17 +10:00
Tyson Clugg
c7ecd60ea7 Refactor pub/sub functionality to fix support for removed. 2015-05-21 12:51:43 +10:00
Tyson Clugg
f1d031313f Bugfix issue where DDP connection thread stops sending messages after changing item that has subscribers for other connections but not self. 2015-05-20 15:05:05 +10:00
Tyson Clugg
0542e31f3d Fix added/changed messages. 2015-05-18 12:39:00 +10:00
Tyson Clugg
6a447b5558 Fix pylint warning about local overwrite of variable. 2015-05-18 12:38:29 +10:00
Tyson Clugg
4fe0a0f858 Send nosub in response to bad sub request. 2015-05-18 12:37:09 +10:00
Tyson Clugg
bd830a4aab Fix change handler for objects updated using F expressions. 2015-05-18 12:35:52 +10:00