On 08/08/2013 08:54 AM, e.c. wrote: > Thanks for these pythons routines, Mark. Since I don't know much about > the language, I need some clarification on the part of the code between > triple quote marks (""") and also between the lines that have > ----------- cut -----. Are these constructs some kind of ad hoc python > syntax extensions for commenting out or do they need to be made > invisible with prepended # characters?
The text contained within the """ marks is a Python docstring. Everything from """Handler to limit a member's posts to a list to M per calendar day or M per through -------------------------- cut ------------ """ is documentation. The lines between -------------------------- cut ------------ lines, i.e., beginning with import copy and ending with mlist.post_period = 0 are what you could put in lists/LISTNAME/extend.py after editing the lines mlist.post_member_limit = 0 mlist.post_list_limit = 0 mlist.post_period = 0 per the comments preceding them. > I would especially like to know whether it's possible to substitute > worldtime (gmt) in the places where localtime is referenced. Yes. Just replace the four occurrences of time.localtime with time.gmtime. Note that this only affects the time zone for determining the current day if the period is the current day rather than a number of hours. > This > posting throttling functionality is needed to make a mailman list > correspond as closely as possible to the functionality once offered by > LISTSERV. Is the part of the code between the cut marks only to be used > if the globals M, L, and PERIOD are to be set with list attributes via > the extend.py file? Could someone comment the code relating to the > global PERIOD and localetime. The extend.py or something equivalent is required in any case tio i8nsert the PostLi8mit handler into the list's pipeline. If period is set to a non-zero value, it is irrelevant whether time is local time or UTC (GMT) because an elapsed number of hours is the same regardless of time zone. > For my purposes PERIOD could be hardcoded > to 24 hours and based on gmt. Just copy the code between the -------------------------- cut ------------ lines to lists/LISTNAME/extend.py and change mlist.post_period = 0 to mlist.post_period = 24 in that file. You will also need to set mlist.post_member_limit = M in that file where M is the maximum number of user posts per 24 hour period, e.g. mlist.post_member_limit = 2 will reject the 3rd post from a member within the last 24 hours, and if you want to limit the total number of list posts, also set mlist.post_list_limit to that limit. > It looks like the code at > http://www.msapiro.net/scripts/PostLimit.py can't be inserted as is into > > Mailman/Handlers/PostLimit.py > > Am I right about that? No, the code at http://www.msapiro.net/scripts/PostLimit.py is intended to be copied as is to Mailman/Handlers/PostLimit.py -- Mark Sapiro <m...@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan ------------------------------------------------------ Mailman-Users mailing list Mailman-Users@python.org http://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://wiki.list.org/x/AgA3 Security Policy: http://wiki.list.org/x/QIA9 Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/ Unsubscribe: http://mail.python.org/mailman/options/mailman-users/archive%40jab.org