From: The Doctor What <[EMAIL PROTECTED]>
> For those of us who are trying to figure out everything at
a low
> level, where would this be in the source?

Here's an example of adding stuff to '_' using a monkey
patch Product.

Contents of of directory Products/MoreBuiltins:

def _AddBuiltins():
  from urllib import urlopen, quote, unquote
  from base64 import decodestring, encodestring

  def same_type(self, a, b):
    return type(a)==type(b)

  def attr_map(self, o):
    r = o.__dict__.copy()
    for k in r.keys():
      if k[:1] == '_':
        del r[k]
    return r

  class AnObject:
    def __init__(self, **kw):

  NewBuiltins = {
    'list': list,
    'tuple': tuple,
    'map': map,
    'filter': filter,
    'reduce': reduce,
    'urllib': AnObject(open=urlopen, quote=quote,
    'base64': AnObject(decode=decodestring,
    'same_type': same_type,
    'attr_map': attr_map,
  from DocumentTemplate.DT_Util import TemplateDict

#call it

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to