Commit Graph

1241 Commits

Author SHA1 Message Date
Unrud
c5342d36d5 Remove BaseCollection.update
I don't think that this can be used for optimizations.

It's useless in the filesystem backend, SQL has REPLACE and I doubt that there is much use in any other storage mechanism.
2016-08-25 06:37:12 +02:00
Unrud
ea63f461a8 Rename upload_all to upload_all_nonatomic 2016-08-25 06:03:13 +02:00
Unrud
30d287ce00 Write files nonatomic in upload_all
It's only used in temporary collections.
2016-08-25 06:03:13 +02:00
Unrud
e31ea57883 Use upload_all for addressbook 2016-08-25 06:03:13 +02:00
Unrud
bc0f8b0a47 Remove duplicate code 2016-08-25 06:03:13 +02:00
Unrud
c57307c585 Rename collections to vobject_items
Like the parameter name of upload_all
2016-08-25 05:52:26 +02:00
Unrud
6045ad97fe Move upload_all from BaseCollection to Collection
This is not used anywhere outside of Collection and probably never will be as WebDAV doesn't support bulk uploads.
2016-08-25 05:47:31 +02:00
Unrud
10786cbad8 Move hook into storage.Collection
The hook is only valid for filesystem storage, it's meaningless for other backends like databases.
2016-08-25 05:40:46 +02:00
Unrud
8db580abce Try to decode URLs with utf-8 (Fixes #486) 2016-08-25 05:30:46 +02:00
Unrud
e40e46e164 Don't disable existing loggers
The logger is retrieved before configure_from_file is called and gets disabled, the same happens when the logging configuration is reloaded.
2016-08-25 05:24:29 +02:00
Unrud
de8c2f0909 Fix SIGHUP handler
The function handler_generator seems useless and the return statement is missing.
2016-08-25 05:24:29 +02:00
Unrud
3b71ab960e Log exceptions (Fixes #447)
Exceptions were just written to stderr but not into logs.
2016-08-25 05:24:24 +02:00
Unrud
c091399f5e Write log to stderr
Be consistent with python's default behavior and play nice with CGI.
2016-08-25 05:19:38 +02:00
Unrud
14515cfe27 Fix logger configuration
Apply patch from #485
2016-08-25 04:29:02 +02:00
Guillaume Ayoub
79bfa9c1d3 Merge pull request #482 from Unrud/smallimprovements
Some small cosmetic improvements for xmlutils
2016-08-24 18:11:06 +02:00
Guillaume Ayoub
c532948348 Merge pull request #487 from Unrud/filter
Fix empty filter
2016-08-24 18:10:03 +02:00
Unrud
f9cabfb20b Test empty filter
Test for d1dbd1df54
2016-08-24 17:52:39 +02:00
Unrud
d1dbd1df54 Fix empty filter
DAVdroid sends <CARD:filter />, which causes an exception.
2016-08-24 17:45:10 +02:00
Unrud
469efbb032 Cosmetics 2016-08-13 04:52:51 +02:00
Unrud
453a8ba636 Fix "fix this" in xmlutils 2016-08-13 04:51:42 +02:00
Unrud
ecd0a16214 Remove unused variable path 2016-08-13 04:48:59 +02:00
Unrud
1c6e626979 Simplify name_from_path and add error check 2016-08-13 04:47:35 +02:00
Guillaume Ayoub
3b29a56c81 Merge pull request #480 from Unrud/currentuserprincipal
Ask for authentication if current-user-principal is requested
2016-08-13 04:25:55 +02:00
Guillaume Ayoub
c9ac3114af Merge pull request #481 from Unrud/patch-35
Revert 1ffc171
2016-08-13 04:22:13 +02:00
Unrud
c29fd1ca61 Check that item is a collection 2016-08-13 00:19:14 +02:00
Unrud
cf4a6ef749 Revert 1ffc171f35
Maybe I misunderstand the RFC, but this properties are related to a principal collection. DAVdroid without preemptive authentication doesn't like this and tries to create calendars and addressbooks in /.
2016-08-13 00:17:50 +02:00
Unrud
4438d2ba9a Require user for current-user-principal
DAVdroid dropped support for preemptive authentication in version 1.2.3.
Returning the DAV:unauthenticated pseudo-principal as specified in RFC 5397 doesn't seem to work for DAVdroid.
2016-08-12 23:41:34 +02:00
Unrud
6515062bcd Return HTTP status in xmlutils.propfind 2016-08-12 23:34:08 +02:00
Guillaume Ayoub
2e29b0a21c Merge pull request #479 from Kozea/upload_all
Add an upload_all method for subsequent optimizations.
2016-08-12 15:08:59 +02:00
Florian Mounier
c95437367f This is very important 2016-08-12 15:05:05 +02:00
Florian Mounier
416f9ddef1 Add an upload_all method for subsequent optimizations. 2016-08-12 14:58:32 +02:00
Guillaume Ayoub
8d863e52b2 Re-enable properties storage on al collections
Fix #475.
2016-08-11 12:07:19 +02:00
Guillaume Ayoub
d3d29802ad Merge pull request #474 from Unrud/patch-31
PROPFIND rights checking
2016-08-11 11:44:43 +02:00
Guillaume Ayoub
e66a35e996 Merge pull request #476 from Unrud/closelockfile
Add option to close lock file
2016-08-11 11:43:40 +02:00
Guillaume Ayoub
f395e256ff Merge pull request #478 from Unrud/patch-33
Correctly write line endings to files
2016-08-11 11:43:18 +02:00
Guillaume Ayoub
f6ebccec57 Merge pull request #477 from Unrud/patch-32
Remove etags from raw data
2016-08-11 11:41:47 +02:00
Unrud
9e84b459ae Correctly write line endings to files
vobject uses \r\n as line endings. Writing this to a file is not a problem on Linux and newer versions of MacOS. On Windows \r\r\n gets written to disk and on older versions of MacOS \r\r gets written to disk, because python replaces \n by the system depended line ending.
2016-08-11 05:43:18 +02:00
Unrud
7a01f905de Enable close_lock_file for tests 2016-08-11 05:20:31 +02:00
Unrud
3f5dd70580 Add option to close lock file
Close the lock file, when no more clients are waiting.
This option is not very useful in general, but on Windows files that are opened cannot be deleted. This causes tests to fail, because the deletion of the temporary filesystem folder fails.
2016-08-11 05:19:23 +02:00
Unrud
0060130c3b Remove etags from raw data
Remove all etags that are directly calculated from data that's read from files.
1. They are not used anywhere (luckily).
2. Etags that are send to clients are calculated from the output of vobject's serialize method. If files are edited externally and vobject normalizes them (like wrapping long lines or replacing all line endings by \r\n), the etags that are sent to the client and the etags that are calculated from raw data will never match. If a new version of vobject is released and the formatting changes slightly, the checks will also always fail.
2016-08-11 05:05:10 +02:00
Guillaume Ayoub
35d12ee97e Merge pull request #472 from Unrud/patch-30
Use os.replace instead of os.rename
2016-08-11 04:23:56 +02:00
Guillaume Ayoub
69386410e5 Merge pull request #473 from Unrud/tests
Tests
2016-08-11 04:23:23 +02:00
Guillaume Ayoub
ac556f2bcc Merge pull request #471 from Unrud/logger
Fix logger
2016-08-11 04:22:41 +02:00
Unrud
4eb04e3526 PROPFIND rights checking
Return 404 and 403 only when it's appropriate. Don't ask users for passwords if an item just doesn't exist (e.g. mistyped URL).
2016-08-11 02:19:48 +02:00
Unrud
30b3273efa Test that the requests fails if the hook fails 2016-08-11 00:37:19 +02:00
Unrud
2b45cffa0e Test that hook gets executed when the principal collection is created
Test for ee5b8facda
2016-08-11 00:37:19 +02:00
Unrud
080ed31d27 Test that storage is locked when hook runs
Test for 65af0592d3
2016-08-11 00:37:19 +02:00
Unrud
952609deee Test that hook gets executed on write accesses 2016-08-11 00:37:19 +02:00
Unrud
893051645e Test fsync
Enable syncing for at least one test.
Test for 5c2075cb6c.
2016-08-11 00:37:19 +02:00
Unrud
6d80b70b8c Test that the root collection always exists
Test for 6c3e59fd11
2016-08-11 00:37:19 +02:00