Exemplo n.º 1
0
 def test_lock_timeout(self):
     from datetime import datetime
     from karl.utilities import lock
     past = datetime(1955, 1, 1, 0, 0, 1)
     past_plus_1 = datetime(1955, 1, 1, 0, 0, 2)
     future = datetime(1985, 1, 1)
     context = karltesting.DummyModel()
     lock.lock(context, 'foo', past)
     self.failUnless(lock.is_locked(context, past_plus_1))
     self.failIf(lock.is_locked(context, future))
Exemplo n.º 2
0
 def test_lock_timeout(self):
     from datetime import datetime
     from karl.utilities import lock
     past = datetime(1955, 1, 1, 0, 0, 1)
     past_plus_1 = datetime(1955, 1, 1, 0, 0, 2)
     future = datetime(1985, 1, 1)
     context = karltesting.DummyModel()
     lock.lock(context, 'foo', past)
     self.failUnless(lock.is_locked(context, past_plus_1))
     self.failIf(lock.is_locked(context, future))
Exemplo n.º 3
0
 def test_lock(self):
     from datetime import datetime
     from karl.utilities import lock
     date = datetime(1985, 1, 1)
     context = karltesting.DummyModel()
     lock.lock(context, 'foo', date)
     self.failUnless(lock.is_locked(context, date))
Exemplo n.º 4
0
 def test_lock(self):
     from datetime import datetime
     from karl.utilities import lock
     date = datetime(1985, 1, 1)
     context = karltesting.DummyModel()
     lock.lock(context, 'foo', date)
     self.failUnless(lock.is_locked(context, date))
Exemplo n.º 5
0
    def __init__(self, context, request):
        self.context = context
        self.request = request

        is_folder = ICommunityFolder.providedBy(context)
        self.use_folder_options = is_folder

        self.use_unlock = lock.is_locked(context)

        title = getattr(context, "title", context.__name__)
        self.page_title = "Advanced Settings for %s" % title
Exemplo n.º 6
0
    def __init__(self, context, request):
        self.context = context
        self.request = request

        is_folder = ICommunityFolder.providedBy(context)
        self.use_folder_options = is_folder

        self.use_unlock = lock.is_locked(context)

        title = getattr(context, 'title', context.__name__)
        self.page_title = 'Advanced Settings for %s' % title
Exemplo n.º 7
0
    def __init__(self, context, request):
        self.context = context
        self.request = request

        in_intranets = find_interface(context, IIntranets) is not None
        is_folder = ICommunityFolder.providedBy(context)
        self.use_folder_options = is_folder and in_intranets

        self.use_unlock = lock.is_locked(context)

        title = getattr(context, 'title', context.__name__)
        self.page_title = 'Advanced Settings for %s' % title
Exemplo n.º 8
0
    def __init__(self, context, request):
        self.context = context
        self.request = request

        in_intranets = find_interface(context, IIntranets) is not None
        is_folder = ICommunityFolder.providedBy(context)
        self.use_folder_options = is_folder and in_intranets

        self.use_unlock = lock.is_locked(context)

        title = getattr(context, 'title', context.__name__)
        self.page_title = 'Advanced Settings for %s' % title
Exemplo n.º 9
0
    def __call__(self):
        if not lock.is_locked(self.context):
            lock.lock(self.context, self.userid)

        page_title = 'Edit %s' % self.context.title
        api = TemplateAPI(self.context, self.request, page_title)
        # prepare client data
        api.karl_client_data['text'] = dict(
                enable_wiki_plugin = True,
                enable_imagedrawer_upload = True,
                )
        return {'api':api,
                'actions':(),
                'lock_info':lock.lock_info_for_view(self.context, self.request),
                }
Exemplo n.º 10
0
    def __call__(self):
        if not lock.is_locked(self.context):
            lock.lock(self.context, self.userid)

        page_title = 'Edit %s' % self.context.title
        api = TemplateAPI(self.context, self.request, page_title)
        # prepare client data
        api.karl_client_data['text'] = dict(
            enable_wiki_plugin=True,
            enable_imagedrawer_upload=True,
        )
        return {
            'api': api,
            'actions': (),
            'lock_info': lock.lock_info_for_view(self.context, self.request),
        }
Exemplo n.º 11
0
    def __call__(self):
        if not lock.is_locked(self.context):
            lock.lock(self.context, self.userid)

        page_title = 'Edit %s' % self.context.title
        api = TemplateAPI(self.context, self.request, page_title)
        # prepare client data
        # ux1
        api.karl_client_data['text'] = dict(
                enable_wiki_plugin = True,
                enable_imagedrawer_upload = True,
                )
        # ux2
        layout = self.request.layout_manager.layout
        layout.head_data['panel_data']['tinymce'] = api.karl_client_data['text']

        return {'api':api,
                'actions':(),
                'lock_info':lock.lock_info_for_view(self.context, self.request),
                }
Exemplo n.º 12
0
    def __call__(self):
        if not lock.is_locked(self.context):
            lock.lock(self.context, self.userid)

        page_title = 'Edit %s' % self.context.title
        api = TemplateAPI(self.context, self.request, page_title)
        # prepare client data
        # ux1
        api.karl_client_data['text'] = dict(
            enable_wiki_plugin=True,
            enable_imagedrawer_upload=True,
        )
        # ux2
        layout = self.request.layout_manager.layout
        layout.head_data['panel_data']['tinymce'] = api.karl_client_data[
            'text']

        return {
            'api': api,
            'actions': (),
            'lock_info': lock.lock_info_for_view(self.context, self.request),
        }
Exemplo n.º 13
0
 def test_clear(self):
     from karl.utilities import lock
     context = karltesting.DummyModel()
     lock.lock(context, 'foo')
     lock.clear(context)
     self.failIf(lock.is_locked(context))
Exemplo n.º 14
0
 def test_unlocked_by_default(self):
     from karl.utilities import lock
     context = karltesting.DummyModel()
     self.failIf(lock.is_locked(context))
Exemplo n.º 15
0
 def test_clear(self):
     from karl.utilities import lock
     context = karltesting.DummyModel()
     lock.lock(context, 'foo')
     lock.clear(context)
     self.failIf(lock.is_locked(context))
Exemplo n.º 16
0
 def test_unlocked_by_default(self):
     from karl.utilities import lock
     context = karltesting.DummyModel()
     self.failIf(lock.is_locked(context))