[ZDP] Zope Quick Ref version 0.01

Martijn Pieters mj@antraciet.nl
Sun, 01 Aug 1999 14:11:03 +0200


>---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>

The latter is now the official syntax. All documentation is going to be
updated. I think that the changes between 1.x and 2 are too great and many
to support both in one reference card. Maybe you better focus on version 2.0.

>	Python String Format syntax
>		%(tag-name  attribute1="value1" attribute2="value2")s

I think you should label this one (and the SSI like syntax) as deprecated,
i.e. better not use if you want to follow the upgrade path.

>	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"-->

I think that any URL save character goes. This text suggests all characters
are allowed. Maybe you better reformulate this to something like:

If the variable name could be interpreted as a python expression, when used
in the 'expr' attribute of a DTML tag you can only reference it using the
namespace variable::

    <dtml-if expr="_['sequence-length'] > 20">

>	Tag Attributes
>			name (may be omitted) - the name of the variable data
>				name="input_name" 
>				input_name

Also caches it's value.

>			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

These are tag dependant. It is true that the in, with, tree, sql-var,
sql-test and var tags share the name and expr attributes, but the fmt
attribute is only found on the var tag.

>	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...
>

I think you better give the different fmt values a diffrent section.

>		if /if
>		if [[elif] else] (endif /if)

It's  if [elif]* [else] /if

The endif syntax can be used instead of /if with the SSI and the python
string format syntax, and also goes for all other enclosing tags (with
endwith, raise endraise, etc.)

>			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 

There is also in [else] /in

>		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

Scope of the let tag is limited, and can only be compaired to the with
"_.namespace()" use of the with tag.

>
>		call
>			evaluate without generating text
>			<!--#call "addDocument('hi','display a greeting','Hello world!')"-->

Make that: evaluate without including any returned value

>		raise /raise
>			report an error
>		try /try
>			error handling (Python class-based exceptions)

that's try [except]* /try (else and finally aren't implemented yet)

>		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

most of these are methods....
missing: range()

>	_ (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
id
title
bobobase_modification_time
get_size
absolute_url
etc.

>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) 

Is this list up to date with Zope 2?

>
>
>Security
>	On a per-item or acquired basis
>	Also local roles (extra roles in the context of this objects and 
>sub-objects)

Local roles: Designated users are given that role when viewing that object
(like Owner).
Proxy Roles, the object assumes that role, wether the user has that role or
not.

	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---

-- 
Martijn Pieters, Web Developer 
| Antraciet http://www.antraciet.nl 
| T: +31 35 7502100 F: +31 35 7502111 
| mj@antraciet.nl http://www.antraciet.nl/~mj 
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 
---------------------------------------------