zope – ein applikationsserver in python!st.inf.tu-dresden.de/files/teaching/ws10/ps/seifert... ·...
TRANSCRIPT
Medienzentrum – Abteilung MIT
Zope – ein Applikationsserver in
Python!
Dresden, 09.12.2010 P. Seifert
Medienzentrum – Abteilung MIT Inhalt
1 Zope Einführung 2 Vorführung Zope Basics 3 Zope für Fortgeschrittene 4 Plone 5 WebCMS der TU Dresden 6 ZopRA 7 Medienzentrum – Abteilung MIT
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 2
Medienzentrum – Abteilung MIT 1 Zope Einführung – Application Server
Application • Module
• RestrictedPython • DateTime • App • AccessControl • ZPublisher • ZServer • ZEO • ZODB • OFS • TAL
• Produkte • ZopePageTemplates • ZCatalog • ZODBMountPoint • SiteErrorLog • Five
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 3
Server • Protokolle / Handler
• HTTP • XMLRPC • FTP • WebDAV • FastCGI
Medienzentrum – Abteilung MIT 1 Zope Einführung – Struktur
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 4
Medienzentrum – Abteilung MIT 1 Zope Einführung – ZMI
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 5
Medienzentrum – Abteilung MIT 1 Zope Einführung – Konfiguration
zope.conf
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 6
zserver-threads 4
<http-server> address 8000 </http-server>
<webdav-source-server> address 141.30.37.134:8001 </webdav-source-server>
<zodb_db main> cache-size 180000 pool-size 7 <filestorage> path /home/peter/devel_zope/zinstance/var/filestorage/Data.fs </filestorage> mount-point / </zodb_db>
Medienzentrum – Abteilung MIT 1 Zope Einführung – Startup
Manueller Start
Vorgang • Laden der Konfiguration • Erstellen der Applikation • Abkopplung des Hauptthreads • Laden der Hauptdatenbank • Erstellen der Handler / Worker
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 7
/my_zope/bin/zopectl start
Medienzentrum – Abteilung MIT 1 Zope Einführung – ZODB
Objektdatenbank • beinhaltet alle Objekte einer Zope-Instanz
Serialisierung • pickle/unpickle • oid • Änderungen am Objekt
Transaktionen (ACID) • Transaktionsmanager • begin/commit/abort
Undo Packing Storages Verknüpfung ZODB – Zope
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 8
Medienzentrum – Abteilung MIT 1 Zope Einführung – OFS
Basispaket CMS SimpleItem
• id • title (property) • /manage • meta_type
ObjectManager • Objekthierarchie • Hinzufügen/Entfernen/Kopieren
PropertyManager • Property-Attribute
Traversable Folder
• SimpleItem • ObjectManager • PropertyManager
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 9
Medienzentrum – Abteilung MIT 1 Zope Einführung – PythonScript
Script-Objekte in Zope Standardvariablen (container, context, ...) Parameterangabe
URL-Aufruf startet Script
Zugriff von anderen Scripten / Objekten
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 10
Script Objekt: a/b/script return „ich bin ein script“
/a/b/script -> „ich bin ein script“
a.b.script -> <PythonScript at script>
a.b.script() -> „ich bin ein script“
Medienzentrum – Abteilung MIT 1 Zope Einführung – Traversal
OFS.Traversable
URL/Pfad – Bereitstellung
Traversierung
Sicherheitschecks
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 11
context.absolute_url() context.getPhysicalPath()
URL: http://141.30.37.134:8000/a/b/script -> „ich bin ein script“
URL: http://141.30.37.134:8000/a/b/c/d Cannot locate object at: http://141.30.37.134:8000/a/b/c/d
Site Error An error was encountered while publishing this resource. Error Type: Unauthorized Error Value: You are not allowed to access ‘manage' in this context
Medienzentrum – Abteilung MIT 1 Zope Einführung – Acquisition
Modul Acquisition Attributzugriff operiert auf Objekthierarchie
Python:
Zope:
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 12
Objekthierarchie: a/b/c >>> obj = getattr(c, "b") AttributeError: ‘Folder' object has no attribute 'b'
Objekthierarchie: a/b/c obj = getattr(c, "b") obj.id -> "b"
Medienzentrum – Abteilung MIT 2 Vorführung Zope Basics
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 13
Medienzentrum – Abteilung MIT 3 Zope für Fortgeschrittene
Templates Security Model Zope 3 Features
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 14
Medienzentrum – Abteilung MIT 3 Zope für Fortgeschrittene - Templates
Template Attribute Language (TAL) • define • condition • repeat • content or replace • attributes • omit-tag
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 15
<h1 tal:content="python: 'content'">bla</h1>
<h1 tal:define="cont string:content" tal:content="cont">bla</h1>
<h1 tal:replace="string:nur Text">bla</h1>
<a tal:attributes="href string:http://test.de">Ziel</a>
Medienzentrum – Abteilung MIT 3 Zope für Fortgeschrittene - Templates
TAL Expression Syntax (TALES)
Variablen
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 16
a a/b/c a|b|c here/x|nothing request/param string:abc python:'abc‘ exists:a/b/c nocall:a/b/c Not:a
nothing repeat root context, here template container request user modules
Medienzentrum – Abteilung MIT 3 Zope für Fortgeschrittene - Templates
Macro Expansion Tag Attribute Language (METAL) • Macros
• Slots
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 17
Template A: <metal:block metal:define-macro="mein_macro">...</metal:block>
Template B: <metal:block metal:use-macro="here/A/macros/mein_macro" />
Template A: <metal:block metal:define-macro="mein_macro"> <div metal:define-slot="mein_slot">Default</div> </metal:block>
Template B: <metal:block metal:use-macro="here/A/macros/mein_macro“> <div metal:fill-slot="mein_slot“> Slot ueberlagert </div> </metal:block>
Medienzentrum – Abteilung MIT 3 Zope für Fortgeschrittene - Security
Users • UserFolder • Login / Passwort / Standard Roles
Roles • Anonymous • Authenticated • Manager
Permissions • View • Manage • Custom Product Permissions • Standard Portal Permissions
Permission Settings • Objektbezug • Nutzerbezug
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 18
Medienzentrum – Abteilung MIT 3 Zope für Fortgeschrittene – Zope 3
Zope 3 – Features mit Five Zope Component Architecture (ZCA) Zope Toolkit (ZTK) Zope 3 Interfaces Adapter ZCML Configuration Zope 3 Views Object Events
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 19
Medienzentrum – Abteilung MIT 3 Zope für Fortgeschrittene – Zope 3
Zope 3 – Features mit Five Zope 3 Interfaces
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 20
from zope.interface import Interface class IMyInterface(Interface): “““Mein Zope3 Interface""“ def myMethod(): "““Methode meines Interfaces"""
from zope.interface import implements from interfaces import IMyInterface class MyClass: implements(IMyInterface) def wer_bin_ich(self): return “MyClass gemaess IMyInterface"
Medienzentrum – Abteilung MIT 3 Zope für Fortgeschrittene – Zope 3
Zope 3 – Features mit Five Adapter
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 21
from zope.interface import Interface class ITargetInterface(Interface): ""“Adapter Interface""“ def wer(): "““Methode des Adapterzielinterfaces"""
from zope.interface import implements from interfaces import ITargetInterface class MyAdapter: implements(ITargetInterface) def __init__(self, context): self.context = context def wer(self): return “Adapter aufgerufen für: %s" %
self.context.wer_bin_ich()
Medienzentrum – Abteilung MIT 3 Zope für Fortgeschrittene – Zope 3
Zope 3 – Features mit Five ZCML Konfiguration
• Verbindung Adapter / Target
• Definition von Views • Laden von Produkten • Abhängigkeiten
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 22
<configure xmlns="http://namespaces.zope.org/zope"> <adapter for=".interfaces.IMyInterface“ provides=".interfaces.ITargetInterface" factory=".classes.MyAdapter" /> </configure>
Medienzentrum – Abteilung MIT 4 Plone
Portal-Layout Standardtemplates Redaktionsumgebung CMF Content Types Workflows Wysiwyg-Editor Tools
• portal_membership • portal_memberdata • portal_skins • portal_actions • portal_languages • portal_css • portal_javascripts • portal_catalog • portal_quickinstaller • portal_types
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 23
Medienzentrum – Abteilung MIT 5 WebCMS
Zope2.11 Plone elevateIT
• Folder • Document • News Article • Event • Image • File • Portlets
TUDAdvance TUDProtect TUDNewsArchiv TUDInstaller Zusatzprodukte
• Maintenance (Cron) • CMFSin (RSS) • ZipImport
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 24
Medienzentrum – Abteilung MIT 5 WebCMS
TUDAdvance TUD Styles Redaktion Ordneransichten Bildergalerien RSS Export jQuery Besucherzähler Redakteurs-News
TUDProtect IP-Schutz Passwort-Schutz Include
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 25
Medienzentrum – Abteilung MIT 5 WebCMS
Zukunft LDAP Support WebDAV Support Community-Funktionalität (Forum / Artikel / Messaging) Neuer Editor Dezentrale Bereichsverwaltung Fußnoten Verbessertes Redaktionssystem Integrierter Nutzersupport
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 26
Medienzentrum – Abteilung MIT 6 ZopRA – Anbindung relationaler DB
Zope Research Architecture Zope Manager Object Model (ZMOM)
• PostgreSQL / MySQL • DB Layout Definition mit XML • Automatische DB-Erzeugung • Erstellen / Bearbeiten / Suchen / Löschen von Einträgen • Import (Excel)
PyHTMLGUI (QT-basiertes Web-Oberflächen-Framework) • Abbildung gängiger Oberflächenelemente auf HTML • Autogenerierte Formular-Seiten für ZMOM • Dialoghandling • Management-Interface für ZMOM
ZopRA Templates • Autogenerierte Formular-Seiten für ZMOM mittels PageTemplates • Leichter anpassbar an WebCMS-basierte Styles • Einfachere Erweiterbarkeit
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 27
Medienzentrum – Abteilung MIT 7 Medienzentrum – Abteilung MIT
Ab 2004 Entwicklung des WebCMS auf Basis von Zope/Plone/elevateIT 2007: Abwanderung der Entwickler Ab 2008: Neubeginn Weiterentwicklung Struktur heute:
• Abteilungsleiter: Herr Miosga • Entwickler: Herr Seifert, Herr Keller • Administration: Herr Jungstand • SHK: Herr Franck, Herr Winter, Herr Stäger, Herr Brünig
März 2010: Weitere Entwicklerstelle Python / CMS April 2010: SHK-Stelle WebCMS-Entwicklung
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 28
Medienzentrum – Abteilung MIT
TU Dresden, 09.12.2010 Zope - ein Applikationsserver in Python Folie 29