Package Products :: Package ZenUtils :: Module FakeRequest |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenUtils.FakeRequest

     1  ###########################################################################
     2  #
     3  # This program is part of Zenoss Core, an open source monitoring platform.
     4  # Copyright (C) 2007, Zenoss Inc.
     5  #
     6  # This program is free software; you can redistribute it and/or modify it
     7  # under the terms of the GNU General Public License version 2 or (at your
     8  # option) any later version as published by the Free Software Foundation.
     9  #
    10  # For complete information please visit: http://www.zenoss.com/oss/
    11  #
    12  ###########################################################################
    13
    14
    15 -class FakeRequest(dict):
    16      ''' Used for ajax calls from event console and elsewhere.  This is used
    17      as a container for REQUEST['message'] which we are interested in.  It has
    18      the advantage over the regular REQUEST object in that it won't actually
    19      bother to render anything when callZenScreen() is called with one.
    20      '''
    21      dontRender = True
    22      dontRedirect = True
    23
    24 -    def __init__(self, *args, **kw):
    25          dict.__init__(self, *args, **kw)
    26          self['oneKeyValueSoInstanceIsntEmptyAndEvalToFalse'] = True
    27
    28 -    def setMessage(self, R):
    29          if R and self.get('message', ''):
    30              R['message'] = self['message']
    31