|
@@ -163,7 +163,8 @@ class Root(DAVCollection):
|
163
|
163
|
environ=self.environ,
|
164
|
164
|
workspace=workspace,
|
165
|
165
|
user=self.user,
|
166
|
|
- session=self.session)
|
|
166
|
+ session=self.session,
|
|
167
|
+ )
|
167
|
168
|
)
|
168
|
169
|
|
169
|
170
|
return members
|
|
@@ -293,8 +294,12 @@ class Workspace(DAVCollection):
|
293
|
294
|
transaction.commit()
|
294
|
295
|
|
295
|
296
|
return Folder('%s/%s' % (self.path, transform_to_display(label)),
|
296
|
|
- self.environ, folder,
|
297
|
|
- self.workspace)
|
|
297
|
+ self.environ,
|
|
298
|
+ content=folder,
|
|
299
|
+ session=self.session,
|
|
300
|
+ user=self.user,
|
|
301
|
+ workspace=self.workspace,
|
|
302
|
+ )
|
298
|
303
|
|
299
|
304
|
def delete(self):
|
300
|
305
|
"""For now, it is not possible to delete a workspace through the webdav client."""
|
|
@@ -337,12 +342,19 @@ class Workspace(DAVCollection):
|
337
|
342
|
environ=self.environ,
|
338
|
343
|
content=content,
|
339
|
344
|
user=self.user,
|
340
|
|
- session=self.session
|
|
345
|
+ session=self.session,
|
341
|
346
|
)
|
342
|
347
|
)
|
343
|
348
|
else:
|
344
|
349
|
self._file_count += 1
|
345
|
|
- members.append(OtherFile(content_path, self.environ, content))
|
|
350
|
+ members.append(
|
|
351
|
+ OtherFile(
|
|
352
|
+ content_path,
|
|
353
|
+ self.environ,
|
|
354
|
+ content,
|
|
355
|
+ session=self.session,
|
|
356
|
+ user=self.user,
|
|
357
|
+ ))
|
346
|
358
|
|
347
|
359
|
if self._file_count > 0 and self.provider.show_history():
|
348
|
360
|
members.append(
|
|
@@ -351,7 +363,9 @@ class Workspace(DAVCollection):
|
351
|
363
|
environ=self.environ,
|
352
|
364
|
content=self.content,
|
353
|
365
|
workspace=self.workspace,
|
354
|
|
- type=HistoryType.Standard
|
|
366
|
+ type=HistoryType.Standard,
|
|
367
|
+ session=self.session,
|
|
368
|
+ user=self.user,
|
355
|
369
|
)
|
356
|
370
|
)
|
357
|
371
|
|
|
@@ -361,7 +375,9 @@ class Workspace(DAVCollection):
|
361
|
375
|
path=self.path + '/' + ".deleted",
|
362
|
376
|
environ=self.environ,
|
363
|
377
|
content=self.content,
|
364
|
|
- workspace=self.workspace
|
|
378
|
+ workspace=self.workspace,
|
|
379
|
+ session=self.session,
|
|
380
|
+ user=self.user,
|
365
|
381
|
)
|
366
|
382
|
)
|
367
|
383
|
|
|
@@ -371,7 +387,9 @@ class Workspace(DAVCollection):
|
371
|
387
|
path=self.path + '/' + ".archived",
|
372
|
388
|
environ=self.environ,
|
373
|
389
|
content=self.content,
|
374
|
|
- workspace=self.workspace
|
|
390
|
+ workspace=self.workspace,
|
|
391
|
+ user=self.user,
|
|
392
|
+ session=self.session,
|
375
|
393
|
)
|
376
|
394
|
)
|
377
|
395
|
|
|
@@ -482,7 +500,10 @@ class Folder(Workspace):
|
482
|
500
|
|
483
|
501
|
def move_folder(self, destpath):
|
484
|
502
|
|
485
|
|
- workspace_api = WorkspaceApi(self.user)
|
|
503
|
+ workspace_api = WorkspaceApi(
|
|
504
|
+ current_user=self.user,
|
|
505
|
+ session=self.session,
|
|
506
|
+ )
|
486
|
507
|
workspace = self.provider.get_workspace_from_path(
|
487
|
508
|
normpath(destpath), workspace_api
|
488
|
509
|
)
|
|
@@ -493,7 +514,11 @@ class Folder(Workspace):
|
493
|
514
|
workspace
|
494
|
515
|
)
|
495
|
516
|
|
496
|
|
- with new_revision(self.content):
|
|
517
|
+ with new_revision(
|
|
518
|
+ content=self.content,
|
|
519
|
+ tm=transaction.manager,
|
|
520
|
+ session=self.session,
|
|
521
|
+ ):
|
497
|
522
|
if basename(destpath) != self.getDisplayName():
|
498
|
523
|
self.content_api.update_content(self.content, transform_to_bdd(basename(destpath)))
|
499
|
524
|
self.content_api.save(self.content)
|
|
@@ -568,7 +593,9 @@ class Folder(Workspace):
|
568
|
593
|
environ=self.environ,
|
569
|
594
|
content=self.content,
|
570
|
595
|
workspace=self.workspace,
|
571
|
|
- type=HistoryType.Standard
|
|
596
|
+ type=HistoryType.Standard,
|
|
597
|
+ user=self.user,
|
|
598
|
+ session=self.session,
|
572
|
599
|
)
|
573
|
600
|
)
|
574
|
601
|
|
|
@@ -578,7 +605,9 @@ class Folder(Workspace):
|
578
|
605
|
path=self.path + '/' + ".deleted",
|
579
|
606
|
environ=self.environ,
|
580
|
607
|
content=self.content,
|
581
|
|
- workspace=self.workspace
|
|
608
|
+ workspace=self.workspace,
|
|
609
|
+ user=self.user,
|
|
610
|
+ session=self.session,
|
582
|
611
|
)
|
583
|
612
|
)
|
584
|
613
|
|
|
@@ -588,12 +617,17 @@ class Folder(Workspace):
|
588
|
617
|
path=self.path + '/' + ".archived",
|
589
|
618
|
environ=self.environ,
|
590
|
619
|
content=self.content,
|
591
|
|
- workspace=self.workspace
|
|
620
|
+ workspace=self.workspace,
|
|
621
|
+ user=self.user,
|
|
622
|
+ session=self.session,
|
592
|
623
|
)
|
593
|
624
|
)
|
594
|
625
|
|
595
|
626
|
return members
|
596
|
627
|
|
|
628
|
+# TODO - G.M - 02-05-2018 - Check these object (History/Deleted/Archived Folder)
|
|
629
|
+# Those object are now not in used by tracim and also not tested,
|
|
630
|
+
|
597
|
631
|
|
598
|
632
|
class HistoryFolder(Folder):
|
599
|
633
|
"""
|
|
@@ -625,7 +659,9 @@ class HistoryFolder(Folder):
|
625
|
659
|
self.content_api = ContentApi(
|
626
|
660
|
current_user=self.user,
|
627
|
661
|
show_archived=self._is_archived,
|
628
|
|
- show_deleted=self._is_deleted
|
|
662
|
+ show_deleted=self._is_deleted,
|
|
663
|
+ session=self.session,
|
|
664
|
+ config=self.provider.app_config,
|
629
|
665
|
)
|
630
|
666
|
|
631
|
667
|
def __repr__(self) -> str:
|
|
@@ -649,7 +685,10 @@ class HistoryFolder(Folder):
|
649
|
685
|
return HistoryFileFolder(
|
650
|
686
|
path='%s/%s' % (self.path, content.get_label_as_file()),
|
651
|
687
|
environ=self.environ,
|
652
|
|
- content=content)
|
|
688
|
+ content=content,
|
|
689
|
+ session=self.session,
|
|
690
|
+ user=self.user,
|
|
691
|
+ )
|
653
|
692
|
|
654
|
693
|
def getMemberNames(self) -> [str]:
|
655
|
694
|
ret = []
|
|
@@ -695,7 +734,10 @@ class HistoryFolder(Folder):
|
695
|
734
|
members.append(HistoryFileFolder(
|
696
|
735
|
path='%s/%s' % (self.path, content.get_label_as_file()),
|
697
|
736
|
environ=self.environ,
|
698
|
|
- content=content))
|
|
737
|
+ content=content,
|
|
738
|
+ user=self.user,
|
|
739
|
+ session=self.session,
|
|
740
|
+ ))
|
699
|
741
|
|
700
|
742
|
return members
|
701
|
743
|
|
|
@@ -780,13 +822,36 @@ class DeletedFolder(HistoryFolder):
|
780
|
822
|
content_path = '%s/%s' % (self.path, transform_to_display(content.get_label_as_file()))
|
781
|
823
|
|
782
|
824
|
if content.type == ContentType.Folder:
|
783
|
|
- members.append(Folder(content_path, self.environ, self.workspace, content))
|
|
825
|
+ members.append(
|
|
826
|
+ Folder(
|
|
827
|
+ content_path,
|
|
828
|
+ self.environ,
|
|
829
|
+ self.workspace,
|
|
830
|
+ content,
|
|
831
|
+ user=self.user,
|
|
832
|
+ session=self.session,
|
|
833
|
+ ))
|
784
|
834
|
elif content.type == ContentType.File:
|
785
|
835
|
self._file_count += 1
|
786
|
|
- members.append(File(content_path, self.environ, content))
|
|
836
|
+ members.append(
|
|
837
|
+ File(
|
|
838
|
+ content_path,
|
|
839
|
+ self.environ,
|
|
840
|
+ content,
|
|
841
|
+ user=self.user,
|
|
842
|
+ session=self.session,
|
|
843
|
+ )
|
|
844
|
+ )
|
787
|
845
|
else:
|
788
|
846
|
self._file_count += 1
|
789
|
|
- members.append(OtherFile(content_path, self.environ, content))
|
|
847
|
+ members.append(
|
|
848
|
+ OtherFile(
|
|
849
|
+ content_path,
|
|
850
|
+ self.environ,
|
|
851
|
+ content,
|
|
852
|
+ user=self.user,
|
|
853
|
+ session=self.session,
|
|
854
|
+ ))
|
790
|
855
|
|
791
|
856
|
if self._file_count > 0 and self.provider.show_history():
|
792
|
857
|
members.append(
|
|
@@ -797,6 +862,7 @@ class DeletedFolder(HistoryFolder):
|
797
|
862
|
workspace=self.workspace,
|
798
|
863
|
user=self.user,
|
799
|
864
|
type=HistoryType.Standard,
|
|
865
|
+ session=self.session,
|
800
|
866
|
)
|
801
|
867
|
)
|
802
|
868
|
|
|
@@ -877,13 +943,35 @@ class ArchivedFolder(HistoryFolder):
|
877
|
943
|
content_path = '%s/%s' % (self.path, transform_to_display(content.get_label_as_file()))
|
878
|
944
|
|
879
|
945
|
if content.type == ContentType.Folder:
|
880
|
|
- members.append(Folder(content_path, self.environ, self.workspace, content))
|
|
946
|
+ members.append(
|
|
947
|
+ Folder(
|
|
948
|
+ content_path,
|
|
949
|
+ self.environ,
|
|
950
|
+ self.workspace,
|
|
951
|
+ content,
|
|
952
|
+ user=self.user,
|
|
953
|
+ session=self.session,
|
|
954
|
+ ))
|
881
|
955
|
elif content.type == ContentType.File:
|
882
|
956
|
self._file_count += 1
|
883
|
|
- members.append(File(content_path, self.environ, content))
|
|
957
|
+ members.append(
|
|
958
|
+ File(
|
|
959
|
+ content_path,
|
|
960
|
+ self.environ,
|
|
961
|
+ content,
|
|
962
|
+ user=self.user,
|
|
963
|
+ session=self.session,
|
|
964
|
+ ))
|
884
|
965
|
else:
|
885
|
966
|
self._file_count += 1
|
886
|
|
- members.append(OtherFile(content_path, self.environ, content))
|
|
967
|
+ members.append(
|
|
968
|
+ OtherFile(
|
|
969
|
+ content_path,
|
|
970
|
+ self.environ,
|
|
971
|
+ content,
|
|
972
|
+ user=self.user,
|
|
973
|
+ session=self.session,
|
|
974
|
+ ))
|
887
|
975
|
|
888
|
976
|
if self._file_count > 0 and self.provider.show_history():
|
889
|
977
|
members.append(
|
|
@@ -893,7 +981,8 @@ class ArchivedFolder(HistoryFolder):
|
893
|
981
|
content=self.content,
|
894
|
982
|
workspace=self.workspace,
|
895
|
983
|
user=self.user,
|
896
|
|
- type=HistoryType.Standard
|
|
984
|
+ type=HistoryType.Standard,
|
|
985
|
+ session=self.session,
|
897
|
986
|
)
|
898
|
987
|
)
|
899
|
988
|
|
|
@@ -955,13 +1044,19 @@ class HistoryFileFolder(HistoryFolder):
|
955
|
1044
|
path='%s%s' % (left_side, transform_to_display(revision.file_name)),
|
956
|
1045
|
environ=self.environ,
|
957
|
1046
|
content=self.content,
|
958
|
|
- content_revision=revision)
|
|
1047
|
+ content_revision=revision,
|
|
1048
|
+ session=self.session,
|
|
1049
|
+ user=self.user,
|
|
1050
|
+ )
|
959
|
1051
|
else:
|
960
|
1052
|
return HistoryOtherFile(
|
961
|
1053
|
path='%s%s' % (left_side, transform_to_display(revision.get_label_as_file())),
|
962
|
1054
|
environ=self.environ,
|
963
|
1055
|
content=self.content,
|
964
|
|
- content_revision=revision)
|
|
1056
|
+ content_revision=revision,
|
|
1057
|
+ session=self.session,
|
|
1058
|
+ user=self.user,
|
|
1059
|
+ )
|
965
|
1060
|
|
966
|
1061
|
def getMemberList(self) -> [_DAVResource]:
|
967
|
1062
|
members = []
|
|
@@ -975,14 +1070,20 @@ class HistoryFileFolder(HistoryFolder):
|
975
|
1070
|
path='%s%s' % (left_side, transform_to_display(content.file_name)),
|
976
|
1071
|
environ=self.environ,
|
977
|
1072
|
content=self.content,
|
978
|
|
- content_revision=content)
|
|
1073
|
+ content_revision=content,
|
|
1074
|
+ user=self.user,
|
|
1075
|
+ session=self.session,
|
|
1076
|
+ )
|
979
|
1077
|
)
|
980
|
1078
|
else:
|
981
|
1079
|
members.append(HistoryOtherFile(
|
982
|
1080
|
path='%s%s' % (left_side, transform_to_display(content.file_name)),
|
983
|
1081
|
environ=self.environ,
|
984
|
1082
|
content=self.content,
|
985
|
|
- content_revision=content)
|
|
1083
|
+ content_revision=content,
|
|
1084
|
+ user=self.user,
|
|
1085
|
+ session=self.session,
|
|
1086
|
+ )
|
986
|
1087
|
)
|
987
|
1088
|
|
988
|
1089
|
return members
|
|
@@ -1322,8 +1423,20 @@ class HistoryOtherFile(OtherFile):
|
1322
|
1423
|
"""
|
1323
|
1424
|
A virtual resource corresponding to a specific tracim's revision's page and thread
|
1324
|
1425
|
"""
|
1325
|
|
- def __init__(self, path: str, environ: dict, content: Content, user:User, content_revision: ContentRevisionRO):
|
1326
|
|
- super(HistoryOtherFile, self).__init__(path, environ, content, user=user, session=self.session)
|
|
1426
|
+ def __init__(self,
|
|
1427
|
+ path: str,
|
|
1428
|
+ environ: dict,
|
|
1429
|
+ content: Content,
|
|
1430
|
+ user:User,
|
|
1431
|
+ content_revision: ContentRevisionRO,
|
|
1432
|
+ session: Session):
|
|
1433
|
+ super(HistoryOtherFile, self).__init__(
|
|
1434
|
+ path,
|
|
1435
|
+ environ,
|
|
1436
|
+ content,
|
|
1437
|
+ user=user,
|
|
1438
|
+ session=session
|
|
1439
|
+ )
|
1327
|
1440
|
self.content_revision = content_revision
|
1328
|
1441
|
self.content_designed = self.design()
|
1329
|
1442
|
|