ExampleITPMonkey/0000755000175000017500000000000010216261501015301 5ustar peterbepeterbe00000000000000ExampleITPMonkey/__init__.py0000644000175000017500000000333010216253441017415 0ustar peterbepeterbe00000000000000## ## Example Zope product that monkey patches the IssueTrackerProduct ## #----------------------------------------------------------------------------- # the usual suspects # # python import os, sys, re # Zope from zLOG import LOG, INFO # our big brother from Products.IssueTrackerProduct import IssueTracker # NB: If we write IssueTracker.IssueTracker # we mean . #----------------------------------------------------------------------------- # Now, let's test if we should go ahead with this at all # # assume that we won't be able to do it do_patch = False # Let's only go ahead with this if the issuetracker # version is above 0.6.4 itpversion = IssueTracker.__version__ major, minor, tiny = [int(number) for number in itpversion.split('.')] if minor >= 6: if tiny >= 4: do_patch = True #----------------------------------------------------------------------------- # We write our own functions that are (to us) vastly superior to those of the # default IssueTrackerProduct # from quotes import quotes as quotesdict from random import shuffle quoteslist = quotesdict.values() # copied and modified from IssueTracker.py around line 500 def showSignature_Quote(self): """ our own custom signature function """ shuffle(quoteslist) return quoteslist[0] #----------------------------------------------------------------------------- # Finally, do the actual monkey patch # if do_patch: # add a new attribute to the class which happens to be # an overwriting. You can add more functions to the class # too if you need to. IssueTracker.IssueTracker.showSignature = showSignature_Quote LOG("ExampleITPMonkey", INFO, "IssueTrackerProduct patched") ExampleITPMonkey/quotes.py0000644000175000017500000000774110216251374017213 0ustar peterbepeterbe00000000000000# nicked from http://www.javascriptkit.com/script/motivatequote.js quotes = {} quotes[0]='There are some people who live in a dream world, and there are some who face reality; and then there are those who turn one into the other. -By Douglas Everett' quotes[1]='Whether you think you can or whether you think you can\'t, you\'re right! -Henry Ford' quotes[2]='I know of no more encouraging fact than the unquestionable ability of man to elevate his life by conscious endeavor. -Henry David Thoreau' quotes[3]='Do not let what you cannot do interfere with what you can do. -John Wooden' quotes[4]='Accept everything about yourself - I mean everything, You are you and that is the beginning and the end - no apologies, no regrets. -Clark Moustakas' quotes[5]='We must accept life for what it actually is - a challenge to our quality without which we should never know of what stuff we are made, or grow to our full stature. -Ida R. Wylie' quotes[6]='High achievement always takes place in the framework of high expectation. -Jack Kinder' quotes[7]='The measure of a man is the way he bears up under misfortune. -Plutarch' quotes[8]='Don\'t wait for your ship to come in, swim out to it. -Anon' quotes[9]='As I grow older, I pay less attention to what men say. I just watch what they do. -Andrew Carnegie' quotes[10]='No steam or gas ever drives anything until it is confined. No Niagara is ever turned into light and power until it is tunneled. No life ever grows until it is focused, dedicated, disciplined. -Harry Emerson Fosdick' quotes[11]='The words printed here are concepts. You must go through the experiences. -Carl Frederick' quotes[12]='Man cannot discover new oceans unless he has the courage to lose sight of the shore. -Andre Gide' quotes[13]='The wise man does at once what the fool does finally. -Baltasar Gracian' quotes[14]='The world has the habit of making room for the man whose actions show that he knows where he is going. -Napoleon Hill' quotes[15]='Success seems to be connected with action. Successful men keep moving. They make mistakes, but they don\'t quit. -Conrad Hilton' quotes[16]='Do the things you know, and you shall learn the truth you need to know. -George Macdonald' quotes[17]='I have never heard anything about the resolutions of the apostles, but a good deal about their acts. -Horace Mann' quotes[18]='Let us not be content to wait and see what will happen, but give us the determination to make the right things happen. -Peter Marshall' quotes[19]='I hear and I forget, I see and I remember. I do and I understand. -Chinese Proverb' quotes[20]='One may walk over the highest mountain one step at a time. -John Wanamaker' quotes[21]='Every action is either strong or weak, and when every action is strong we are successful. -Wallace D. Wattles' quotes[22]='If we do what is necessary, all the odds are in our favor. -Henry Kissinger' quotes[23]='Little minds are tamed and subdued by misfortune; but great minds rise above them. -Washington Irving' quotes[24]='When an affliction happens to you, you either let it defeat you, or you defeat it... -Rosalind Russell' quotes[25]='There\'s a basic human weakness inherent in all people which tempts them to want what they can\'t have and not want what is readily available to them. -Robert J. Ringer' quotes[26]='If there is something to gain and nothing to lose by asking, by all means ask! -W. Clement Stone' quotes[27]='It\'s not the situation ... It\'s your reaction to the situation -Robert Conklin' quotes[28]='Life at any time can become difficult: life at any time can become easy. It all depends upon how one adjusts oneself to life. -Morarji Desai' quotes[29]='What happens is not as important as how you react to what happens. -Thaddeus Golas' quotes[30]='To hell with circumstances; I create opportunities. -Bruce Lee'ExampleITPMonkey/README.txt0000644000175000017500000000066110216254137017011 0ustar peterbepeterbe00000000000000=== ExampleITPMonkey === By Peter Bengtsson, mail@peterbe.com, 2005 www.issuetrackerproduct.com == Overview == Example Python product for how you can write a monkey patch for the IssueTrackerProduct. With this as an example more people might be inspired to start writing patching code for the IssueTrackerProduct == Installation == Put this in the same Products folder as you have your IssueTrackerProduct folder. Restart Zope.