Initial import

This commit is contained in:
Gaetan Delannay 2009-06-29 14:06:01 +02:00
commit 4043163fc4
427 changed files with 18387 additions and 0 deletions

Binary file not shown.

View file

@ -0,0 +1,6 @@
from appy.gen import *
class Engine:
engineType = String()
description = String(format=String.XHTML)
pod = True

View file

@ -0,0 +1,5 @@
from appy.gen import *
class Radio:
abstract = True
name = String()

View file

@ -0,0 +1,6 @@
from appy.gen import *
class Wheel:
title = String(multiplicity=(1,1))
description = String(format=String.XHTML)

View file

@ -0,0 +1,37 @@
from appy.gen import *
from AppyCar.Interior.Radio import Radio
class RallyCarWorkflow:
# Roles
carDriver = 'CarDriver'
driverM = ('Manager', carDriver)
# Specific permissions
readColor = ReadPermission('Car.color')
writeColor = WritePermission('Car.color')
# States
created = State({r:driverM, w:driverM, d:driverM,
readColor: driverM, writeColor: driverM}, initial=True)
running = State({r:driverM, w:driverM, d:driverM,
readColor: 'Manager', writeColor: 'Manager'})
# Transitions
run = Transition( (created, running), condition=driverM)
stop = Transition( (running, created), condition=driverM)
class Car:
sport = Boolean()
color = String(specificReadPermission=True, specificWritePermission=True)
description = String(format=String.TEXT)
class RallyCar(Car):
root = True
workflow = RallyCarWorkflow
test = Integer()
class StandardRadio(Radio):
test1 = Integer()
c = Config()
c.languages = ('en', 'fr')
class CarFlavour(Flavour):
explanation = String(group="userInterface")

View file

@ -0,0 +1,10 @@
from appy.gen import *
class Meeting:
place = String(editDefault=True)
date = Date()
myObservations = String(format=String.XHTML, optional=True)
annex = File(optional=True)
leader = String(validator=['andyStein', 'joelLambillotte'])
root = True
pod = ['Meeting']

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,10 @@
This folder contains some example Appy applications used for testing purposes.
Directly in the folder, you have the application "AppyMeeting" which consists in
a single Python file (module AppyMeeting.py) and a POD template for producing
documents (Meeting.odt). You also have simple applications Zzz.py and
ZopeComponent.py that are one-file applications.
In sub-folder AppyCar, you have a more complex application that is structured
as a Python package (a hierarchy of folders).

Binary file not shown.

View file

@ -0,0 +1,140 @@
from appy.gen import *
class BunchOfGeek:
description = String(format=String.TEXT)
class ZopeComponentTool(Tool):
someUsefulConfigurationOption = String()
def onInstall(self):
self.someUsefulConfigurationOption = 'My app is configured now!'
install = Action(action=onInstall)
class ZopeComponentFlavour(Flavour):
anIntegerOption = Integer()
bunchesOfGeeks = Ref(BunchOfGeek, multiplicity=(0,None), add=True,
link=False, back=Ref(attribute='backToTool'),
shownInfo=('description',), page='data')
def onEdit(self, created):
if 'Escadron de la mort' not in [b.title for b in self.bunchesOfGeeks]:
self.create('bunchesOfGeeks', title='Escadron de la mort',
description='I want those guys everywhere!')
class ZopeComponentWorkflow:
# Specific permissions
wf = WritePermission('ZopeComponent.funeralDate')
rb = ReadPermission('ZopeComponent.responsibleBunch')
# Roles
zManager = 'ZManager'
zLeader = 'ZLeader'
managerM = (zManager, 'Manager')
leaderM = (zLeader, 'Manager')
everybody = (zManager, zLeader, 'Manager')
# States
created = State({r:leaderM, w:('Owner', 'Manager'), d:leaderM, wf:'Owner',
rb:everybody}, initial=True)
validated = State({r:everybody, w:everybody, d:None, wf:everybody,
rb:everybody})
underDevelopment = State({r:everybody, w:leaderM, d:None, wf:leaderM,
rb:everybody})
whereIsTheClient = State({r:everybody, w:managerM, d:None, wf:managerM,
rb:everybody})
# Transitions
def funeralOk(self, obj): return obj.funeralDate
validate = Transition( (created, validated),
condition=managerM + (funeralOk,))
def updateDescription(self, obj):
obj.description = 'Description edited by my manager was silly.'
startDevelopment = Transition( (validated, underDevelopment),
condition=leaderM, action=updateDescription)
cancelDevelopment = Transition( (underDevelopment, whereIsTheClient),
condition=managerM)
cancel = Transition( ( (whereIsTheClient, underDevelopment),
(underDevelopment, validated),
(validated, created)), condition='Manager')
class ZopeComponent:
root = True
workflow = ZopeComponentWorkflow
def showDate(self):
return True
def validateDescription(self, value):
res = True
if value.find('simple') != -1:
res = self.translate('zope_3_is_not_simple')
return res
description = String(editDefault=True)
technicalDescription = String(format=String.XHTML,
validator=validateDescription)
#status = String(validator=['underDevelopement', 'stillSomeWorkToPerform',
# 'weAreAlmostFinished', 'alphaReleaseIsBugged', 'whereIsTheClient'],
# optional=True, editDefault=True)
funeralDate = Date(optional=True, specificWritePermission=True)
responsibleBunch = Ref(BunchOfGeek, multiplicity=(1,1), add=False,
link=True, back=Ref(attribute='components'),
specificReadPermission=True)
class CobolComponentWorkflow(ZopeComponentWorkflow):
p = ZopeComponentWorkflow # Shortcut to workflow parent
# An additional state
finished = State(p.whereIsTheClient.permissions)
# Override validate: condition on funeralDate has no sense here
validate = Transition(p.validate.states, condition=p.managerM)
# Override cancelDevelopment: go to finished instead
cancelDevelopment = Transition( (p.underDevelopment, finished),
condition=p.managerM)
# Update cancel accordingly
cancel = Transition( ((finished, p.underDevelopment),) +p.cancel.states[1:],
condition=p.cancel.condition)
class CobolComponent:
root = True
workflow = CobolComponentWorkflow
description = String()
class Person:
abstract = True
pod = True
title = String(show=False)
n = 'name_3'
firstName = String(group=n, width=15)
middleInitial = String(group=n, width=3)
name = String(multiplicity=(1,1), group=n, width=30)
contractDetails = String(format=String.XHTML)
cia = {'page': 'contactInformation', 'group': 'address_2'}
street = String(**cia)
number = Integer(**cia)
country = String(**cia)
zipCode = Integer(**cia)
cio = {'page': 'contactInformation', 'group': 'numbers_2', 'width': 20}
phoneNumber = String(**cio)
faxNumber = String(**cio)
mobilePhone = String(**cio)
workPhoneNumber = String(**cio)
workFaxNumber = String(**cio)
workMobilePhone = String(**cio)
def onEdit(self, created):
self.title = self.firstName + ' ' + self.name
class Worker(Person):
root = True
productivity = Integer()
class Parasite(Person):
root = True
pod = ['SordidGossips', 'MoreGossips']
hairColor = String(group='hairyCharacteristics')
sordidGossips = String(format = String.XHTML, page='Gossips')
parasiteIndex = String(validator=['low', 'medium', 'high',
'unquantifiable'],
page='contactInformation', group='numbers')
details = String(page='contactInformation', group='numbers',
master=parasiteIndex, masterValue='unquantifiable')
avoidAnyPhysicalContact = Boolean(page='contactInformation')
def validate(self, new, errors):
if (new.hairColor == 'flashy') and (new.firstName == 'Gerard'):
errors.hairColor = True
errors.firstName = "Flashy Gerards are disgusting."
c = Config()
c.languages = ('en', 'fr')
c.defaultCreators += ['ZLeader']

View file

@ -0,0 +1,67 @@
from appy.gen import *
class Zzz:
root = True
def show_f2(self): return True
def validate_i2(self, value):
if (value != None) and (value < 10):
return 'Value must be higher or equal to 10.'
return True
title=String(multiplicity=(0,1), show=False)
i1 = Integer(show=False)
i2 = Integer(validator = validate_i2)
f1 = Float(show=show_f2, page='other')
f2 = Float(multiplicity=(1,1))
class SeveralStrings:
root=True
anEmail = String(validator=String.EMAIL)
anUrl = String(validator=String.URL)
anAlphanumericValue = String(validator=String.ALPHANUMERIC)
aSingleSelectedValue = String(validator=['valueA', 'valueB', 'valueC'])
aSingleMandatorySelectedValue = String(
validator=['valueX', 'valueY', 'valueZ'], multiplicity=(1,1))
aMultipleSelectedValue = String(
validator=['valueS', 'valueT', 'valueU', 'valueV'],
multiplicity=(1,None), searchable=True)
aBooleanValue = Boolean(default=True)
dateWithHour = Date()
dateWithoutHour = Date(format=Date.WITHOUT_HOUR)
anAttachedFile = File()
anAttachedImage = File(isImage=True)
class Product:
root = True
description = String(format=String.TEXT)
stock = Integer()
def needOrder(self): return self.stock < 3
def orderProduct(self): self.stock = 3
order = Action(action=orderProduct, show=needOrder)
class Order:
description = String(format=String.TEXT)
number = Float(show=False)
# Reference field
def getReference(self): return 'OR-%f' % self.number
reference = Computed(method=getReference)
def filterProducts(self, allProducts):
return [f for f in allProducts if f.description.find('Descr') != -1]
products = Ref(Product, add=False, link=True, multiplicity=(1,None),
back=Ref(attribute='orders'), showHeaders=True,
shownInfo=('description','title', 'order'),
select=filterProducts)
def onEdit(self, created):
if created:
import random
self.number = random.random()
class Client:
root = True
folder = True
title = String(show=False)
firstName = String()
name = String()
orders = Ref(Order, add=True, link=False, multiplicity=(0,None),
back=Ref(attribute='client'), showHeaders=True,
shownInfo=('reference', 'description', 'products'), wide=True)
def onEdit(self, created):
self.title = self.firstName + ' ' + self.name