[ZDP] Zope Quick Ref version 0.01
Evelyn Mitchell
efm@tummy.com
Sat, 31 Jul 1999 20:40:45 -0600
I've come up with a quick first stab at an outline for a
Zope Quick Reference Card.
I'd like feedback at this stage on what I've missed in terms of
broad topic areas.
As well, I'd like to hear of areas which have changed between
Zope 1 and Zope 2 that need to addressed.
Any and all other comments are appreciated.
Evelyn Mitchell
efm@tummy.com
---begin zope quick ref---
DTML
Tag syntax
<!--#tag-name attribute1="value1" attribute2="value2" ... -->
Experimental tag syntax (Zope 2.x only)
<dtml-tagname attribute1="value1" attribute2="value2" ...> </dtml-tagname>
Python String Format syntax
%(tag-name attribute1="value1" attribute2="value2")s
Variable names
a-zA-Z[0-9a-za-Z_]
If the variable doesn't follow this rule, it must begin with the
special namespace variable _
<!--#if "_['sequence-length'] > 20"-->
Tag Attributes
name (may be omitted) - the name of the variable data
name="input_name"
input_name
capitalize - The first letter of the inserted text should be capitalized.
expr
Syntax is that of Python. Examples:
expr="age > 18"
"age > 18"
x*2+3
func(a,b)
obj.title
obj.meth(a,b)
(age < 12 or age > 65) and status == 'student'
REQUEST['HTTP_REFERER']
fmt
Tags
var
Substitutes variable data into text
Empty tag
Attributes
name(arg)
expr(arg)
fmt(arg)
special, custom or C-style format
whole-dollars
dollars-and-cents
collection-length
Date-time formats
AMPM
AMPMMinutes
aCommon
aCommonZ
aDay
aMonth
ampm
Date
Day
DayOfWeek
day
dayOfYear
dd
fCommon
fCommonZ
h_12
h_24
hour
isCurrentHour
isCurrentMonth
isFuture
isLeapYear
isPast
Mon_
Mon
Month
minute
mm
month
notEqualTo(t)
PreciseAMPM
PreciseTime
pCommon
pCommonZ
pDay
pMonth
rfc822
second
TimeMinutes
Time
timezone
year
yy
C-style
d
e
E
f
g
G
I
o
s
u
x
X
null(arg) specify what should be used to display a null value
<!--#var cost fmt="$%.2d" null='n/a'-->
lower
upper
capitalize
spacify
thousands_commas
html_quote
url_quote
sql_quote
newline_to_br
size(arg)
etc(yes) default is ...
<!--#var spam size=10 etc="..."-->
red yellow...
if /if
if [[elif] else] (endif /if)
Attributes
name
expr
unless /unless
Attributes
name
expr
in /in Iterative Insertion
Attributes
name=arg
expr=arg
mapping=arg
sort=arg
start=arg
size=arg
skip_unauthorized
orphan=arg
overlap=arg
previous
next
Variables defined by the in tag
sequence-item[-even|-odd]
sequence-key[-even|-odd]
sequence-index[-var-xxx]
where xxx is an element attribute name or key
sequence-start
sequence-end
Summary variables (where nnn is a variable name)
total-nnn
count-nnn
min-nnn
max-nnn
median-nnn
mean-nnn
variance-nnn
variance-n-nnn
standard-deviation-nnn
standard-deviation-n-nnn
Grouping variables (where nnn is a variable name)
first-nnn
last-nnn
Batch processing variables
sequence-query
sequence-step-size
previous-sequence
previous-sequence-start-index
previous-sequence-end-index
previous-sequence-size
previous-batches
next-sequence
next-sequence-start-index
next-sequence-end-index
next-sequence-size
next-batches
Attributes of next- previous- batches
batch-start-index
batch-end-index
batch-size
with /with
Expand the namespace of a document template by adding
attributes or mapping keys from an object which already
exists in the document template namespace.
Attributes
only - prunes enclosing nampespaces
let
similar to with, multiple assignments
call
evaluate without generating text
<!--#call "addDocument('hi','display a greeting','Hello world!')"-->
raise /raise
report an error
try /try
error handling (Python class-based exceptions)
comment /comment
tree /tree
display Zope objects hierarchically
Attributes
name=arg
expr=arg
branches=arg
branches_expr=arg
id=arg
url=arg
leaves=arg
header=arg
footer=arg
nowrap=arg
sort=arg
assume_children=arg
single=arg
skip_unauthorized=arg
Variables set by tree tag
tree-item-expanded
tree-item-url
tree-root-url
tree-level
tree-colspan
tree-state
Variables that influnce the tree tag
expand-all
collapse-all
tree-s
tree-e
tree-c
sendmail
Attributes
mailhost
smtphost
port
mailto
mailfrom
subject
mime
Attributes
type
disposition
encode
_ (special namespace variable) Attributes
abs(x)
chr(l)
divmod(A,B)
float(X)
getattr(O, name)
hasattr(O,name)
getitem(name,flag)
hash(O)
hex(X)
int(X)
len(S)
math
max(S)
min(S)
namespace(name1=value1, name2=value2...)
None
oct(X)
ord(C)
pow(X,Y)
round(X,N)
str(O)
string
whrandom
_ (special namespace variable) Methods
has_key
<!--#if "_.has_key('sequence-length')"-->
getitem(name, returnValueFlag)
<!--#var "_.getitem(name, 0)"-->
Math module attributes
acos(X)
asin(X)
atan(X)
atan2(X,Y)
ceil(X)
cosh(X)
e
expr(X)
fabs(X)
floor(X)
fmod(X,Y)
frexp(X)
hypot(X,Y)
hypot(X,Y)
ldexp(X,Y)
log(X)
log10(X)
modf(X)
pi
pow(X,Y)
sin(X)
sinh(X)
sqrt(X)
tan(X)
tanh(X)
String module attributes
digits
hexdigits
letters
lowercase
octdigits
uppercase
whitespace
atof(X)
atoi(S[, BASE[)
capitalize(W)
capwords(S)
find(S, SUB[, START])
rfind(S, SUB[, START])
index(S, SUB[, START])
rindex(S, SUB[, START])
count(S, SUB[, START])
lower(S)
maketrans(FROM, TO)
split(S [,SEP [, MAX]])
join(WORDS[, SEP])
lstrip(S)
rstrip(S)
strip(S)
swapcase(S)
translate(S,TABLE[, DELS])
upper(S)
ljust(S, WIDTH)
rjust(S, WIDTH)
center(S, WIDTH)
zfill(S, WIDTH)
whrandom module attributes
choice(seq)
randint(a,b)
random()
seed(X,Y,Z)
univorm(a,b)
Zope-defined Web request variables
AUTHENTICATED_USER
AUTHENTICATION_PATH
PARENTS
REQUEST
cookies
form
has_key(name)
set(name, value)
RESPONSE
setStatus(status)
setHeader(name, value)
getStatus()
setBase(base)
expireCookie(name)
setCookie(name,value,...)
getHeader(name)
appendHeader(name, value)
redirect(location)
URL
CGI-defined Web request variables
SERVER_SOFTWARE
SERVER_NAME
GATEWAY_INTERFACE
SERVER_PROTOCOL
SERVER_PORT
REQUEST_METHOD
PATH_INFO
PATH_TRANSLATED
SCRIPT_NAME
QUERY_STRING
REMOTE_HOST
REMOTE_ADDR
AUTH_TYPE
REMOTE_USER
REMOTE_IDENT
CONTENT_TYPE
CONTENT_LENGTH
Document template classes
DocumentTemplate.HTML
DocumentTemplate.HTMLFile
DocumentTemplate.String
DocumentTemplate.File
Document template creation arguments
(source_string|filename, mapping, __name__)
Example:
results=DocumentTemplate.HTMLFile('results.dtml',
{'table_name': 'search results', 'database': 'data'},
pid=os.getpid(),
time=time.time
)
Callng Document templates
(client, mapping)
Usage
return results(None, {'search_results': r})
return results(search_results=r)
Using document templates with ZPublisher
Default Document Source
standard_html_header
standard_html_footer
title_or_id
title_and_id
document_id
document_title
Object Reference
DTML Document methods
PUT (self, REQUEST, RESPONSE)
manage_edit(self, data, title, [SUBMIT, dtpref_cols, dtpref_rows, REQUEST])
manage_upload(self, [file, REQUEST])
DTML Method
PUT (self, REQUEST, RESPONSE)
document_src(self, REQUEST, RESPONSE)
manage_FTPget(self)
manage_FTPlist(self, REQUEST)
manage_FTPstat(self, REQUEST)
manage_edit(self, data, title, [SUBMIT, dtpref_cols, dtpref_rows, REQUEST])
manage_proxy(self, [roles, REQUEST])
manage_upload(self, [file, REQUEST])
Database Management
DELETE(self, REQUEST, RESPONSE)
HEAD(self, REQUEST, RESPONSE)
PROPFIND(self, REQUEST, RESPONSE)
PROPPATCH(self, REQUEST, RESPONSE)
External Method
manage_edit (self, title, module, function, [REQUEST])
File
DELETE(self, REQUEST, RESPONSE)
PUT(self, REQUEST, RESPONSE)
getContentType(self)
getSize(self)
index_html(self, REQUEST, RESPONSE)
manage_FTPget(self)
manage_FTPlist(self, REQUEST)
manage_FTPstat(self, REQUEST)
manage_edit(self, title, content_type, [precondition, REQUEST])
manage_upload(self, [file, REQUEST])
view_image_or_file(self, URL1)
Folder
manage_addMailHost(self, id, [title, smtp_host, localhost, smtp_port,
timeout, REQUEST])
manage_createWizard(self, connection_id, REQUEST)
Image
DELETE(self, REQUEST, RESPONSE)
PUT(self, REQUEST, RESPONSE)
getContentType(self)
getSize(self)
index_html(self, REQUEST, RESPONSE)
manage_FTPget(self)
manage_FTPlist(self, REQUEST)
manage_FTPstat(self, REQUEST)
manage_edit(self, title, content_type, [precondition, REQUEST])
manage_upload(self, [file, REQUEST])
Mail Host
manage_makeChanges(self, title, localHost, smtpHost, smtpPort,
timeout, [REQUEST])
Object Manager
manage_FTPlist(self, REQUEST)
manage_FTPstat(self, REQUEST)
manage_delObjects(self, [ids, REQUEST])
manage_exportObject(self, [id, download, RESPONSE])
manage_importObject(self, file, [REQUEST])
objectIds(self, [spec])
objectItems(self, [spec])
objectValues(self, [spec])
P SQL Input Wizard
createSQLInput(self, RESPONSE, URL2, formId, resultId, sqlId,
[formTitle, resultTitle, sqlTitle])
getObjectsInfo(self, REQUEST)
index_html(self)
quit(self, RESPONSE, URL2)
Product
mange_createWizard(self, connection_id, REQUEST)
User Folder
getUser(self, name)
getUserNames(self)
getUsers(self)
manage_users(self, [submit, REQUEST, RESPONSE])
Version
discard(self, [REQUEST])
enter(self, REQUEST, RESPONSE)
leave(self, REQUEST, RESPONSE)
leave_another(self, REQUEST, RESPONSE)
manage_edit(self, title, [REQUEST])
save(self, remark, [REQUEST])
Version Management
DELETE(self, REQUEST, RESPONSE)
HEAD(self, REQUEST, RESPONSE)
PROPFIND(self, REQUEST, RESPONSE)
PROPPATCH(self, REQUEST, RESPONSE)
Zope Draft
manage_Discard__draft__(self, [REQUEST])
manage_Save__draft__(self, remark, [REQUEST])
Zope Factory
DELETE(self, REQUEST, RESPONSE)
HEAD(self, REQUEST, RESPONSE)
PROPFIND(self, REQUEST, RESPONSE)
PROPPATCH(self, REQUEST, RESPONSE)
Security
On a per-item or acquired basis
Also local roles (extra roles in the context of this objects and sub-objects) Acquire Permissions
Permission
Roles
Anonymous
Manager
Owner
Undo
Select changes and undo them
Find
Simple
Find objects of type
(varies according to where it is called from)
with ids: (id)
containing: (keywords)
modified
before/after (date)
search only in this folder/search all subfolders
Advanced
Find objects of type
(varies according to where it is called from)
with ids: (id)
containing: (keywords)
expr: (regular expression?)
modified
before/after (date)
where the roles: (Anonymous/Manager/Owner)
have permission: (Permissions select list)
search only in this folder/search all subfolders
Control Panel
Zope version information
Zope version
Python version
System Platform
Process ID
Process lifetime
Shutdown
Database Management
Database
Size
Location
Pack (remove old revisions)
Cache Parameters
Number of Objects in DB
Number of objects in cache
Target size of cache (set)
Target maximum time between accesses (set)
Mean time since last access
Deallocation rate (objects/minute)
Deactivation rate (objects/minute)
Time of last cache garbage collection
Flush Cache
Manual Cache Garbage collection
Version Management (ZODB3 only)
Product Management
Contents
Properties
change
delete
Add
Id
type
boolean
date
float
int
lines
long
string (default)
text
tokens
selection
multiple selection
Version
Coypright
License
---end Zope Quick Ref---