Edit detail for pycode revision 1 of 1

1
Editor: Ed Leafe
Time: 2007/01/12 11:13:41 GMT+0
Note:

changed:
-
This is a Dabo Wiki-specific tag used to format and colorize your Python code. Here's a sample, using code from the SimpleFormWithBizobj.py demo code. This is what it looks like in the wiki editor:

----

<pre>&lt;pycode&gt;
class MyBizobj(dBizobj):
	# This is a subclass of dabo's dBizobj base class. Look how simple it
	# is to set up the required parameters.

	def beforeInit(self):
		self.DataSource = "zipcodes"     # the alias for the bizobj/cursor
		self.KeyField = "iid"            # the primary key
		self.RequeryOnLoad = False       # don't do an implicit requery on init

		# Set the default values for new records added
		defaultValues = {"ccity":"Penfield", "cstateprov":"NY", "czip":"14526"}
&lt;/pycode&gt;</pre>

----

And this is how it is rendered:

----

<pycode>
class MyBizobj(dBizobj):
	# This is a subclass of dabo's dBizobj base class. Look how simple it
	# is to set up the required parameters.

	def beforeInit(self):
		self.DataSource = "zipcodes"     # the alias for the bizobj/cursor
		self.KeyField = "iid"            # the primary key
		self.RequeryOnLoad = False       # don't do an implicit requery on init

		# Set the default values for new records added
		defaultValues = {"ccity":"Penfield", "cstateprov":"NY", "czip":"14526"}
</pycode>

#red#**NOTE**##: this only works on pages set to use the **Structured Text** markup type. It doesn't work at all with any other markup type.




This is a Dabo Wiki-specific tag used to format and colorize your Python code. Here's a sample, using code from the SimpleFormWithBizobj.py demo code. This is what it looks like in the wiki editor:


<pycode>
class MyBizobj(dBizobj):
        # This is a subclass of dabo's dBizobj base class. Look how simple it
        # is to set up the required parameters.

def beforeInit(self): self.DataSource = "zipcodes" # the alias for the bizobj/cursor self.KeyField = "iid" # the primary key self.RequeryOnLoad = False # don't do an implicit requery on init

# Set the default values for new records added defaultValues = {"ccity":"Penfield", "cstateprov":"NY", "czip":"14526"} </pycode>


And this is how it is rendered:


class MyBizobj(dBizobj):
        # This is a subclass of dabo's dBizobj base class. Look how simple it
        # is to set up the required parameters.
        def beforeInit(self):
                self.DataSource = "zipcodes"     # the alias for the bizobj/cursor
                self.KeyField = "iid"            # the primary key
                self.RequeryOnLoad = False       # don't do an implicit requery on init
                # Set the default values for new records added
                defaultValues = {"ccity":"Penfield", "cstateprov":"NY", "czip":"14526"}

NOTE: this only works on pages set to use the Structured Text markup type. It doesn't work at all with any other markup type.