Skip to content

Commit

Permalink
added _ prefix to push and pop methods to make them private
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Fulton committed Nov 19, 1997
1 parent 1f54070 commit 9b3faa7
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 23 deletions.
11 changes: 7 additions & 4 deletions DT_In.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
of the module 'Missing', if present.
''' #'

__rcs_id__='$Id: DT_In.py,v 1.11 1997/11/12 23:25:56 jim Exp $'
__rcs_id__='$Id: DT_In.py,v 1.12 1997/11/19 15:42:46 jim Exp $'

############################################################################
# Copyright
Expand Down Expand Up @@ -284,7 +284,7 @@
# (540) 371-6909
#
############################################################################
__version__='$Revision: 1.11 $'[11:-2]
__version__='$Revision: 1.12 $'[11:-2]

from DT_Util import *
from string import find, atoi, join
Expand Down Expand Up @@ -397,7 +397,7 @@ def render(self, md):
kw['sequence-step-end']=end
kw['sequence-step-orphan']=orphan
try:
md.push(vars)
md._push(vars)
if previous:
if first > 0:
pstart,pend,psize=opt(None,first+overlap,
Expand Down Expand Up @@ -463,7 +463,7 @@ def render(self, md):
result.append(section(client,md))
result=join(result, '')
finally:
md.pop(1)
md._pop(1)

return result

Expand Down Expand Up @@ -791,6 +791,9 @@ def previous_batches(self):

############################################################################
# $Log: DT_In.py,v $
# Revision 1.12 1997/11/19 15:42:46 jim
# added _ prefix to push and pop methods to make them private
#
# Revision 1.11 1997/11/12 23:25:56 jim
# Fixed bug in expr handling.
#
Expand Down
6 changes: 3 additions & 3 deletions DT_String.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,13 @@ def __call__(self,client=None,mapping={},**kw):
if pushed is not None:
# We were passed a TemplateDict, so we must be a sub-template
md=mapping
push=md.push
push=md._push
if globals:
push(self.globals)
pushed=pushed+1
else:
md=TemplateDict()
push=md.push
push=md._push
shared_globals=self.shared_globals
if shared_globals: push(shared_globals)
if globals: push(globals)
Expand Down Expand Up @@ -367,7 +367,7 @@ def __call__(self,client=None,mapping={},**kw):
try:
return render_blocks(self,md)
finally:
if pushed: md.pop(pushed) # Get rid of circular reference!
if pushed: md._pop(pushed) # Get rid of circular reference!
md.level=level # Restore previous level

validate=None
Expand Down
9 changes: 5 additions & 4 deletions DT_Util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'''$Id: DT_Util.py,v 1.16 1997/11/19 15:33:32 jim Exp $'''
'''$Id: DT_Util.py,v 1.17 1997/11/19 15:42:47 jim Exp $'''

############################################################################
# Copyright
Expand Down Expand Up @@ -52,7 +52,7 @@
# (540) 371-6909
#
############################################################################
__version__='$Revision: 1.16 $'[11:-2]
__version__='$Revision: 1.17 $'[11:-2]

import sys, regex, string, types, math, os
from string import rfind, strip, joinfields, atoi,lower,upper,capitalize
Expand Down Expand Up @@ -285,10 +285,11 @@ def parse_params(text,
try: from cDocumentTemplate import InstanceDict, TemplateDict, render_blocks
except: from pDocumentTemplate import InstanceDict, TemplateDict, render_blocks

# TemplateDict.pop.__roles__=TemplateDict.push.__roles__=()

############################################################################
# $Log: DT_Util.py,v $
# Revision 1.17 1997/11/19 15:42:47 jim
# added _ prefix to push and pop methods to make them private
#
# Revision 1.16 1997/11/19 15:33:32 jim
# Updated parse_params so that you can define an attribute that, if
# used, must have a value. This is done by specifying None as a default
Expand Down
15 changes: 9 additions & 6 deletions cDocumentTemplate.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

static char cDocumentTemplate_module_documentation[] =
""
"\n$Id: cDocumentTemplate.c,v 1.7 1997/11/07 18:51:47 jim Exp $"
"\n$Id: cDocumentTemplate.c,v 1.8 1997/11/19 15:42:47 jim Exp $"
;

#include "ExtensionClass.h"
Expand Down Expand Up @@ -341,10 +341,10 @@ MM_has_key(MM *self, PyObject *args)
static struct PyMethodDef MM_methods[] = {
{"__init__", (PyCFunction)MM__init__, 0,
"__init__() -- Create a new empty multi-mapping"},
{"push", (PyCFunction) MM_push, 0,
"push(mapping_object) -- Add a data source"},
{"pop", (PyCFunction) MM_pop, 0,
"pop() -- Remove and return the last data source added"},
{"_push", (PyCFunction) MM_push, 0,
"_push(mapping_object) -- Add a data source"},
{"_pop", (PyCFunction) MM_pop, 0,
"_pop() -- Remove and return the last data source added"},
{"getitem", (PyCFunction) MM_get, METH_VARARGS,
"getitem(key[,call]) -- Get a value\n\n"
"Normally, callable objects that can be called without arguments are\n"
Expand Down Expand Up @@ -529,7 +529,7 @@ void
initcDocumentTemplate()
{
PyObject *m, *d;
char *rev="$Revision: 1.7 $";
char *rev="$Revision: 1.8 $";

UNLESS(py_isDocTemp=PyString_FromString("isDocTemp")) return;
UNLESS(py_blocks=PyString_FromString("blocks")) return;
Expand Down Expand Up @@ -561,6 +561,9 @@ initcDocumentTemplate()
Revision Log:
$Log: cDocumentTemplate.c,v $
Revision 1.8 1997/11/19 15:42:47 jim
added _ prefix to push and pop methods to make them private
Revision 1.7 1997/11/07 18:51:47 jim
Fixed bug in new call logic.
Expand Down
15 changes: 9 additions & 6 deletions pDocumentTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
__doc__='''Python implementations of document template some features
$Id: pDocumentTemplate.py,v 1.6 1997/11/11 18:39:29 jim Exp $'''
__version__='$Revision: 1.6 $'[11:-2]
$Id: pDocumentTemplate.py,v 1.7 1997/11/19 15:42:48 jim Exp $'''
__version__='$Revision: 1.7 $'[11:-2]

import regex, string

Expand Down Expand Up @@ -140,13 +140,13 @@ class TemplateDict:

level=0

def pop(self, n): return self.dicts.pop(n)
def push(self, d): return self.dicts.push(d)
def _pop(self, n): return self.dicts.pop(n)
def _push(self, d): return self.dicts.push(d)

def __init__(self):
m=self.dicts=MultiMapping()
self.pop=m.pop
self.push=m.push
self._pop=m.pop
self._push=m.push
try: self.keys=m.keys
except: pass

Expand Down Expand Up @@ -177,6 +177,9 @@ def render_blocks(self, md):
##############################################################################
#
# $Log: pDocumentTemplate.py,v $
# Revision 1.7 1997/11/19 15:42:48 jim
# added _ prefix to push and pop methods to make them private
#
# Revision 1.6 1997/11/11 18:39:29 jim
# Added a little compatibility with cDocumentTemplate.
#
Expand Down

0 comments on commit 9b3faa7

Please sign in to comment.