Code Duplication    Length = 29-37 lines in 2 locations

browsepy/file.py 2 locations

@@ 261-297 (lines=37) @@
258
    encoding = 'default'
259
    generic = False
260
261
    @cached_property
262
    def widgets(self):
263
        widgets = super(Directory, self).widgets
264
        if self.can_upload:
265
            widgets.extend((
266
                self.plugin_manager.create_widget(
267
                    'head',
268
                    'script',
269
                    file=self,
270
                    endpoint='static',
271
                    filename='browse.directory.head.js'
272
                ),
273
                self.plugin_manager.create_widget(
274
                    'scripts',
275
                    'script',
276
                    file=self,
277
                    endpoint='static',
278
                    filename='browse.directory.body.js'
279
                ),
280
                self.plugin_manager.create_widget(
281
                    'header',
282
                    'upload',
283
                    file=self,
284
                    text='Upload',
285
                    endpoint='upload'
286
                    )
287
                ))
288
        if self.can_download:
289
            action = self.plugin_manager.create_widget(
290
                'entry-actions',
291
                'button',
292
                file=self,
293
                css='download',
294
                endpoint='download_directory'
295
                )
296
            widgets.append(action)
297
        return widgets
298
299
    @property
300
    def link(self):
@@ 51-79 (lines=29) @@
48
    def plugin_manager(self):
49
        return self.app.extensions['plugin_manager']
50
51
    @cached_property
52
    def widgets(self):
53
        widgets = self.plugin_manager.get_widgets(file=self)
54
        widgets.extend((
55
            self.plugin_manager.create_widget(
56
                'head',
57
                'script',
58
                file=self,
59
                endpoint='static',
60
                filename='browse.body.js'
61
                ),
62
            self.plugin_manager.create_widget(
63
                'scripts',
64
                'script',
65
                file=self,
66
                endpoint='static',
67
                filename='browse.body.js'
68
                )
69
        ))
70
        if self.can_remove:
71
            action = self.plugin_manager.create_widget(
72
                'entry-actions',
73
                'button',
74
                file=self,
75
                css='remove',
76
                endpoint='remove'
77
                )
78
            widgets.append(action)
79
        return widgets
80
81
    @cached_property
82
    def link(self):