Ignore:
Timestamp:
26 Oct 2008, 19:14:17 (16 years ago)
Author:
hraban
Message:

Adding and editing of all objects works now. Templates enhanced (not only for debugging). Still no tests. Added SVN-IDs.

Location:
waeup/branches/hraban/src/waeup
Files:
4 added
52 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/hraban/src/waeup/README.txt

    • Property svn:keywords set to Id
    r3523 r3737  
     1.. $Id$
     2
    13The waeup package
    24********************
  • waeup/branches/hraban/src/waeup/__init__.py

    • Property svn:keywords set to Id
    r3521 r3737  
     1# $Id$
  • waeup/branches/hraban/src/waeup/app.py

    • Property svn:keywords set to Id
    r3571 r3737  
     1# $Id$
    12import grok
    23#from zope.interface import Interface
     
    1718        self.__dict__.update(kw)
    1819       
    19         sc = studentcontainer.StudentContainer()
    20         self["students"] = sc       
    21    
    22         hc = hostelcontainer.HostelContainer()
    23         self["hostels"] = hc
    24    
    25         fc = facultycontainer.FacultyContainer()
    26         self["faculties"] = fc
     20        self["students"] = studentcontainer.StudentContainer()       
     21        self["hostels"] = hostelcontainer.HostelContainer()
     22        self["faculties"] = facultycontainer.FacultyContainer()
    2723
    2824#class Content(grok.Viewlet):
  • waeup/branches/hraban/src/waeup/app_templates/content.pt

    • Property svn:keywords set to Id
    r3566 r3737  
     1<!-- $Id$ -->
    12  <ul>
    23    <li tal:repeat="fac context/values">
  • waeup/branches/hraban/src/waeup/app_templates/master.pt

    • Property svn:keywords set to Id
    r3530 r3737  
    22    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    33<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
     4<!-- $Id$ -->
    45        <head>
    56                <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  • waeup/branches/hraban/src/waeup/basecontainer.py

    • Property svn:keywords set to Id
    r3571 r3737  
    11# -*- coding: utf-8 -*-
     2# $Id$
    23import grok
    34import os
     
    56import waeup.viewlets as vw
    67from zope.component import getMultiAdapter
     8from waeup.permissions import *
    79
    810class BaseContainer(grok.Container):
     
    2022        super(BaseContainer, self).__init__()
    2123        self.__dict__.update(kwargs)
    22    
    23 class Content(grok.Viewlet):
    24     """
    25     Base viewlet
    26     """
    27     grok.viewletmanager(vw.MainArea)
    28     grok.view(vw.Index)
    29     #grok.order(1)
     24        self.ViewPermission = ViewBase
     25        self.AddPermission = AddBase
     26        self.EditPermission = EditBase
     27
     28## Forms
     29
     30class DisplayForm(grok.DisplayForm):
     31    grok.template('content')
     32
     33    def __init__(self, context, request):
     34        super(DisplayForm, self).__init__(context, request)
     35        self.form_fields = grok.AutoFields(self.context.__class__)
    3036
    3137class AddForm(grok.AddForm):
    32     template = grok.PageTemplate(filename=os.path.join('basecontainer_templates', 'edit_form.pt'))
     38    #template = grok.PageTemplate(filename=os.path.join('basecontainer_templates', 'edit_form.pt'))
     39    grok.template('edit_form')
    3340
    3441    def __init__(self, context, request):
    3542        super(AddForm, self).__init__(context, request)
     43        # ein Objekt der untergeordneten Klasse hinzufügen!
    3644        self.form_fields = grok.AutoFields(self.context.childClass)
    3745
     
    4048        obj = self.context.childClass(**data)
    4149        id = data['id'].lower()
    42         self.context[id] = obj # schlägt fehlt bei nicht-Container-Objekten (not iterable)
     50        #print "Add to container %s, ID %s, Obj %s" % (self.context, id, obj)
     51        self.context[id] = obj # schlägt fehlt bei falschem Interface! (not iterable)
    4352        self.redirect(self.url('@@index'))
    4453
    4554class EditForm(grok.EditForm):
    46     template = grok.PageTemplate(filename=os.path.join('basecontainer_templates', 'edit_form.pt'))
     55    #template = grok.PageTemplate(filename=os.path.join('basecontainer_templates', 'edit_form.pt'))
     56    grok.template('edit_form')
    4757    #form_fields = grok.AutoFields(BaseContainer)
    4858
     
    5161        self.form_fields = grok.AutoFields(self.context.__class__)
    5262       
    53     def handle_edit_action(self, **data):
    54         grok.EditForm.handle_edit_action(self, **data)
    55         self.redirect(self.url('@@index'))
     63#    def handle_edit_action(self, **data):
     64#        grok.EditForm.handle_edit_action(self, **data)
     65#        self.redirect(self.url('@@index'))
    5666
     67## Viewlets
     68
     69class DisplayViewlet(grok.Viewlet):
     70    grok.viewletmanager(vw.MainArea)
     71    grok.context(IBaseContainer)
     72    grok.view(vw.Index)
     73
     74    def update(self):
     75        self.form = getMultiAdapter((self.context, self.request),
     76                                    name='displayform')
     77        self.form.update_form()
     78
     79    def render(self):
     80        return self.form.render()
     81   
    5782class AddViewlet(grok.Viewlet):
    5883    grok.viewletmanager(vw.MainArea)
  • waeup/branches/hraban/src/waeup/basecontainer_templates/content.pt

    • Property svn:keywords set to Id
    r3566 r3737  
     1<!-- $Id$ -->
     2<div class="breadcrumbs">
     3                <a href="" tal:attributes="href python:view.url(context.__parent__)">
     4                <span tal:condition="exists:context/__parent__/title" tal:content="context/__parent__/title">Part of</span>
     5                <span tal:condition="exists:context/__parent__/name" tal:content="context/__parent__/name">Parent</span>
     6                </a>
     7</div>
     8<h2><span tal:condition="exists:context/title" tal:content="context/title">Part of</span> <span tal:content="context/name">Objects</span></h2>
    19<div class="menubar">
    210        <ul>
     
    1119</div>
    1220
    13 <h2 tal:content="context/name">Objects</h2>
     21<div class="form-fields">
     22<h3>
     23        <tal:block tal:condition="exists:context/childClass/plural_name" ><span tal:content="context/childClass/plural_name">Parts</span>
     24        in </tal:block><span tal:condition="exists:context/title" tal:content="context/title">Part of</span> <span tal:content="context/name">Objects</span>:
     25</h3>
    1426<ul>
    15         <li tal:repeat="item context/values"><a  tal:condition="exists:item/name" href="" tal:attributes="href  python:view.url(item)" tal:content="item/name">Item</a></li>
     27        <li tal:repeat="item context/values" class="form-line">
     28                <a tal:condition="exists:item/name" href="" tal:attributes="href  python:view.url(item)" tal:content="item/name" class="field">Item</a>
     29        </li>
    1630</ul>
     31</div>
     32
     33<div class="form-fields">
     34    <tal:block repeat="widget view/widgets">
     35        <div class="form-line">
     36            <span class="label" tal:content="widget/label">label</span>:
     37            <span class="field" tal:content="structure widget">value</span>
     38        </div>
     39    </tal:block>
     40</div>
     41
     42
     43<div class="form-fields introspection">
     44    <tal:block repeat="item python:context.__dict__.keys()">
     45        <div class="form-line">
     46            <span class="label" tal:content="item">Key</span>:
     47            <span class="field" tal:content="python:context.__dict__[item]">Value</span>
     48        </div>
     49    </tal:block>
     50</div>
  • waeup/branches/hraban/src/waeup/basecontainer_templates/edit_form.pt

    • Property svn:keywords set to Id
    r3571 r3737  
     1<!-- $Id -->
    12<form action="." tal:attributes="action request/URL" method="post" class="edit-form" enctype="multipart/form-data">
    2     <!--
    3     <h2 i18n:translate=""
    4     tal:condition="view/label"
    5     tal:content="view/label">Label</h2>
    6     <div class="form-status"
    7     tal:define="status view/status"
    8     tal:condition="status">
    9     <div i18n:translate="" tal:content="view/status">
    10     Form status summary
     3   
     4    <h2 i18n:translate="" tal:condition="view/label" tal:content="view/label">Label</h2>       
     5    <div class="form-status" tal:define="status view/status" tal:condition="status">
     6       
     7            <div i18n:translate="" tal:content="view/status">Form status summary</div>
     8       
     9        <ul class="errors" tal:condition="view/errors">
     10                <li tal:repeat="error view/error_views">
     11                        <span tal:replace="structure error">Error Type</span>
     12                    </li>
     13        </ul>
    1114    </div>
    12     <ul class="errors" tal:condition="view/errors">
    13     <li tal:repeat="error view/error_views">
    14     <span tal:replace="structure error">Error Type</span>
    15     </li>
    16     </ul>
    17     </div>
    18     -->
     15   
    1916    <div class="form-fields">
    2017        <tal:block repeat="widget view/widgets">
     
    2219                <span class="label" tal:define="hint widget/hint">
    2320                    <label tal:condition="python:hint" tal:attributes="for widget/name">
     21                        <span i18n:translate="" tal:content="widget/label">label</span>
    2422                        <span class="required" tal:condition="widget/required">*</span>
    25                         <span i18n:translate="" tal:content="widget/label">label</span>
    2623                    </label>
    2724                    <label tal:condition="python:not hint" tal:attributes="for widget/name">
     25                        <span i18n:translate="" tal:content="widget/label">label</span>
    2826                        <span class="required" tal:condition="widget/required">*</span>
    29                         <span i18n:translate="" tal:content="widget/label">label</span>
    3027                    </label>
    3128                </span>
  • waeup/branches/hraban/src/waeup/baseitem.py

    • Property svn:keywords set to Id
    r3571 r3737  
    1 # baseitem.py
     1# -*- coding: utf-8 -*-
     2# $Id$
    23import os
    34import grok
     
    56from waeup.interfaces import IBaseItem
    67from zope.component import getMultiAdapter
     8from waeup.permissions import *
    79
    810class BaseItem(grok.Model):
     
    1416    def __init__(self, **kwargs):
    1517        super(BaseItem, self).__init__()
     18        self.ViewPermission = ViewBase
     19        self.AddPermission = AddBase
     20        self.EditPermission = EditBase
    1621        self.__dict__.update(kwargs)
    1722
    18 class Index(grok.Viewlet):
    19     grok.viewletmanager(vw.MainArea)
    20     #grok.context(IBaseItem)
    21     #grok.order(1)
    22     #grok.View(Index) # warum gibt das hier einen Fehler?
     23## Forms
     24
     25class DisplayForm(grok.DisplayForm):
     26    #template = grok.PageTemplate(filename=os.path.join('baseitem_templates', 'content.pt'))
    2327    grok.template('content')
    2428
     29    def __init__(self, context, request):
     30        super(DisplayForm, self).__init__(context, request)
     31        self.form_fields = grok.AutoFields(self.context.__class__)
     32
     33# Wird wahrscheinlich nie benutzt - was sollte man einem Item hinzufügen?
    2534class AddForm(grok.AddForm):
    2635    template = grok.PageTemplate(filename=os.path.join('basecontainer_templates', 'edit_form.pt'))
     36   
    2737
    2838    def __init__(self, context, request):
    2939        super(AddForm, self).__init__(context, request)
    30         self.form_fields = grok.AutoFields(self.context-__class__) #.childClass)
     40        self.form_fields = grok.AutoFields(self.context.__class__)
     41        #grok.require(context.__class__.AddPermission)
    3142
    3243    @grok.action('Add item')
     
    3445        obj = self.context.__class__(**data) #.childClass(**data)
    3546        id = data['id'].lower()
     47        print "Add to item %s, ID %s, Obj %s" % (self.context, id, obj)
    3648        self.context[id] = obj
    3749        self.redirect(self.url('@@index'))
     
    3951class EditForm(grok.EditForm):
    4052    template = grok.PageTemplate(filename=os.path.join('basecontainer_templates', 'edit_form.pt'))
     53   
    4154   
    4255    def __init__(self, context, request):
    4356        super(EditForm, self).__init__(context, request)
    4457        self.form_fields = grok.AutoFields(self.context.__class__)
    45        
    46     def handle_edit_action(self, **data):
    47         grok.EditForm.handle_edit_action(self, **data)
    48         self.redirect(self.url('@@index'))
     58        #grok.require(context.__class__.EditPermission)
     59
     60#    def handle_edit_action(self, **data):
     61#        grok.EditForm.handle_edit_action(self, **data)
     62
     63#    @grok.action(u"Edit item")
     64#    def edit(self, **data):
     65#        id = data['id'].lower()
     66#        obj = self.context[id]
     67#        self.applyData(obj, **data)
     68#        self.redirect(self.url('@@index')) # FIXME: funktioniert nicht!?
     69
     70## Viewlets
     71
     72class DisplayViewlet(grok.Viewlet):
     73    grok.viewletmanager(vw.MainArea)
     74    grok.context(IBaseItem)
     75    grok.view(vw.Index)
     76    #grok.order(1)
     77    #grok.template('content')
     78   
     79    #def __init__(self, context, request, *other):
     80    #    super(Index, self).__init__(context, request, *other)
     81    #    grok.require(self.context.__class__.ViewPermission)
     82
     83    def update(self):
     84        self.form = getMultiAdapter((self.context, self.request),
     85                                    name='displayform')
     86        self.form.update_form()
     87
     88    def render(self):
     89        return self.form.render()
     90
    4991
    5092class AddViewlet(grok.Viewlet):
  • waeup/branches/hraban/src/waeup/baseitem_templates/content.pt

    • Property svn:keywords set to Id
    r3562 r3737  
     1<!-- $Id$ -->
     2<div class="breadcrumbs">
     3                <a href="" tal:attributes="href python:view.url(context.__parent__)">
     4                <span tal:condition="exists:context/__parent__/title" tal:content="context/__parent__/title">Part of</span>
     5                <span tal:condition="exists:context/__parent__/name" tal:content="context/__parent__/name">Parent</span>
     6                </a>
     7</div>
     8<h2><span tal:condition="exists:context/title" tal:content="context/title">Part of</span> <span tal:content="context/name">Objects</span></h2>
    19<div class="menubar">
    210        <ul>
    311                <li><a href="" tal:attributes="href python:view.url(context.__parent__)">Up</a></li>
    412                <li><a href="" tal:attributes="href python:view.url(context, '@@edit')">Edit</a></li>
    5                 <li><a href="" tal:attributes="href python:view.url(context, '@@add')">Add</a></li>
     13                <!-- <li><a href="" tal:attributes="href python:view.url(context, '@@add')">Add</a></li> -->
    614        </ul>
    715</div>
    8 <h2>Object <span tal:replace="context/name">Name</span></h2>
     16
     17<div class="form-fields">
     18    <tal:block repeat="widget view/widgets">
     19        <div class="form-line">
     20            <span class="label" tal:content="widget/label">label</span>:
     21            <span class="field" tal:content="structure widget">value</span>
     22        </div>
     23    </tal:block>
     24</div>
     25
     26<div class="form-fields introspection">
     27    <tal:block repeat="item python:context.__dict__.keys()">
     28        <div class="form-line">
     29            <span class="label" tal:content="item">Key</span>:
     30            <span class="field" tal:content="python:context.__dict__[item]">Value</span>
     31        </div>
     32    </tal:block>
     33</div>
  • waeup/branches/hraban/src/waeup/baseitem_templates/edit_form.pt

    • Property svn:keywords set to Id
    r3557 r3737  
     1<!-- $Id$ -->
     2<!-- Achtung, wird nicht benutzt! Statt dessen "basecontainer_templates/edit_form.pt"! -->
    13<form action="." tal:attributes="action request/URL" method="post"
    24      class="edit-form" enctype="multipart/form-data">
  • waeup/branches/hraban/src/waeup/browser.txt

    • Property svn:keywords set to Id
    r3523 r3737  
     1.. $Id$
     2
    13The waeup package
    24********************
  • waeup/branches/hraban/src/waeup/catalog.py

    • Property svn:keywords set to Id
    r3571 r3737  
     1# $Id$
    12import grok, grok.index
    23from hurry.query.query import Query, Text
  • waeup/branches/hraban/src/waeup/catalog_templates/studentsearch.pt

    • Property svn:keywords set to Id
    r3571 r3737  
     1<!-- $Id$ -->
    12<div class="portlet">
    23  <form>
  • waeup/branches/hraban/src/waeup/docs/faq-staff-de.rst

    r3558 r3737  
     1.. $Id$
    12=============
    23FAQ (deutsch)
  • waeup/branches/hraban/src/waeup/docs/uli-on-interfaces.txt

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/hostel/__init__.py

    • Property svn:keywords set to Id
    r3566 r3737  
     1# $Id$
    12from interfaces import IHostel
    23from hostelcontainer import HostelContainer
  • waeup/branches/hraban/src/waeup/hostel/hostel.py

    • Property svn:keywords set to Id
    r3571 r3737  
     1# $Id$
    12import grok
    23import waeup.baseitem as base
    34from waeup.hostel.interfaces import IHostel
    4 
     5from waeup.hostel.permissions import *
    56
    67class Hostel(base.BaseItem):
     
    910    grok.implements(IHostel)
    1011    name = u'Hostel'
     12    ViewPermission = ViewHostel
     13    AddPermission = AddHostel
     14    EditPermission = EditHostel
  • waeup/branches/hraban/src/waeup/hostel/hostelcontainer.py

    • Property svn:keywords set to Id
    r3571 r3737  
     1# $Id$
    12import grok
    23from waeup.hostel.interfaces import IHostelContainer
  • waeup/branches/hraban/src/waeup/hostel/interfaces.py

    • Property svn:keywords set to Id
    r3571 r3737  
    1 ##
    2 ## interfaces.py
     1# $Id$
    32import grok
    43import re
  • waeup/branches/hraban/src/waeup/interfaces.py

    • Property svn:keywords set to Id
    r3566 r3737  
    1 ##
    21## interfaces.py
     2# $Id$
    33import grok
    44import re
     
    4141        )
    4242
    43 
    4443class IUniversity(grok.interfaces.IContainer):
    4544    """Representation of a university.
  • waeup/branches/hraban/src/waeup/permissions.py

    • Property svn:keywords set to Id
    r3521 r3737  
     1# $Id$
    12import grok
    23
    3 class FacultyRead(grok.Permission):
    4     grok.name('waeup.facultyread')
    54
     5class ViewBase(grok.Permission):
     6    grok.name('waeup.ViewBase')
     7    grok.title('View Base')
     8   
     9class EditBase(grok.Permission):
     10    grok.name('waeup.EditBase')
     11    grok.title('Edit Base')
     12   
     13class AddBase(grok.Permission):
     14    grok.name('waeup.AddBase')
     15    grok.title('Add Base')
     16
     17
     18class ViewUniversity(grok.Permission):
     19    grok.name('waeup.ViewUniversity')
     20    grok.title('View University')
     21   
     22class EditUniversity(grok.Permission):
     23    grok.name('waeup.EditUniversity')
     24    grok.title('Edit University')
     25   
     26class AddUniversity(grok.Permission):
     27    grok.name('waeup.AddUniversity')
     28    grok.title('Add University')
  • waeup/branches/hraban/src/waeup/static/app.css

    • Property svn:keywords set to Id
    r3562 r3737  
     1/* $Id */
     2
    13html {
    24        font-family: JansonText, Georgia, Times;
     
    3537
    3638#logo img {
    37         align: left;
     39        text-align: left;
    3840        float: left;
    3941        padding-right: 2em;
     
    129131        border: 1px solid #feb;
    130132        padding: 1em;
     133        margin-bottom: 1em;
    131134}
    132135
     
    134137        min-height: 1em;
    135138        clear: both;
     139        padding: 0.125em 0 0.125em 0;
    136140}
    137141
    138142.form-fields .label {
    139         width: 20em;
     143        display: inline-block;
     144        width: 10em;
    140145        padding-right: 1em;
     146        vertical-align: top;
    141147}
    142148
     
    147153
    148154.form-fields .field {
    149        
    150155}
    151156
     
    154159        width: 30em;
    155160}
     161
     162dl {
     163        clear: both;
     164}
     165
     166dl dt {
     167        min-width: 10em;
     168        float: left;
     169        clear: left;
     170        font-weight: bold;
     171}
     172
     173dl dd {
     174        float: left;
     175}
     176
     177.introspection > * {
     178        display:none;
     179}
     180
     181.introspection:hover > * {
     182        display: block;
     183}
  • waeup/branches/hraban/src/waeup/students/__init__.py

    • Property svn:keywords set to Id
    r3526 r3737  
     1# $Id$
  • waeup/branches/hraban/src/waeup/students/interfaces.py

    • Property svn:keywords set to Id
    r3571 r3737  
    1 ##
    2 ## interfaces.py
     1# $Id$
    32import grok
    43import re
     
    109    pass
    1110
    12 class IStudent(Interface):
     11class IStudent(IBaseItem):
    1312    """Representation of a student.
    1413    """
     
    1817        required = True,
    1918        constraint=(re.compile("^([A-Z]\d{6})?$").match)
     19        )
     20    name = schema.TextLine(
     21        title = u'Name of student',
     22        default = u'Nobody',
     23        required = True,
    2024        )
    2125    entry_mode = schema.ASCIILine( # Choice?
     
    3236        max=600
    3337        )
    34     name = schema.TextLine(
    35         title = u'Name of student',
    36         default = u'Nobody',
    37         required = True,
    38         )
    3938    jamb_reg_no = schema.ASCIILine(
    40         title = u'JAMB Reg. No.',
     39        title = u'JAMB Reg. No.', # wie ZVS
    4140        default = '',
    4241        required = False,
  • waeup/branches/hraban/src/waeup/students/student.py

    • Property svn:keywords set to Id
    r3571 r3737  
     1# $Id$
    12import grok
    23import waeup.baseitem as base
    34from interfaces import IStudent
     5from waeup.students.permissions import *
    46
    57def fromCsv(a):
     
    2022    grok.implements(IStudent)
    2123    name = u'Student'
    22 
    23     fields = [   "entry_mode",
    24                  "end_level",
    25                  "name",
    26                  "jamb_reg_no",
    27                  "level",
    28                  "id",
    29                  "lga",
    30                  "entry_session",
    31                  "matric_no",
    32                  "sex",
    33                  "phone",
    34                  "session",
    35                  "course",
    36                  "mode",
    37                  "faculty",
    38                  "department",
    39                  "verdict",
    40                  "review_state",
    41                  "perm_address",
    42                  "email"
    43             ]
    44        
    45 
    46     def getCsv(self):
    47         #return self.entry_mode, self.end_level, self.name, self.jamb_reg_no, self.level, self.id, self.lga, self.entry_session, self.matric_no, self.sex, self.phone, self.session, self.course, self.mode, self.faculty, self.department, self.verdict, self.review_state,  self.perm_address, self.email
    48         return [getattr(self, field, u"") for field in self.fields]
     24    ViewPermission = ViewStudent
     25    AddPermission = AddStudent
     26    EditPermission = EditStudent
     27#
     28#    fields = [   "entry_mode",
     29#                 "end_level",
     30#                 "name",
     31#                 "jamb_reg_no",
     32#                 "level",
     33#                 "id",
     34#                 "lga",
     35#                 "entry_session",
     36#                 "matric_no",
     37#                 "sex",
     38#                 "phone",
     39#                 "session",
     40#                 "course",
     41#                 "mode",
     42#                 "faculty",
     43#                 "department",
     44#                 "verdict",
     45#                 "review_state",
     46#                 "perm_address",
     47#                 "email"
     48#            ]
     49#       
     50#
     51#    def getCsv(self):
     52#        #return self.entry_mode, self.end_level, self.name, self.jamb_reg_no, self.level, self.id, self.lga, self.entry_session, self.matric_no, self.sex, self.phone, self.session, self.course, self.mode, self.faculty, self.department, self.verdict, self.review_state,  self.perm_address, self.email
     53#        return [getattr(self, field, u"") for field in self.fields]
    4954
    5055
    5156#class AddViewlet(base.AddViewlet):
    5257#    grok.context(IStudent)
     58#    grok.require(waeup.students.AddStudent)
    5359#
    54 #class EditEditViewlet(base.EditViewlet):
     60#class EditViewlet(base.EditViewlet):
    5561#    grok.context(IStudent)
     62#    grok.require(waeup.students.EditStudent)
  • waeup/branches/hraban/src/waeup/students/student.txt

    • Property svn:keywords set to Id
    r3526 r3737  
    1 waeup_ng.student
     1.. $Id$
     2
     3waeup.students
    24****************
    35
     
    68We can create students::
    79
    8   >>> from waeup_ng.student import Student
     10  >>> from waeup.students import Student
    911  >>> s = Student(name='Foo Bar')
    1012  >>> s
     
    1416
    1517  >>> s.name
    16   'Mr. Nobody'
     18  'Nobody'
    1719
  • waeup/branches/hraban/src/waeup/students/studentcontainer.py

    • Property svn:keywords set to Id
    r3571 r3737  
     1# $Id$
    12import grok
    23import os
  • waeup/branches/hraban/src/waeup/testing.py

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/tests/__init__.py

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/tests/namelist.txt

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/tests/test_waeup.py

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/tests/util.py

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/university/__init__.py

    • Property svn:keywords set to Id
    r3566 r3737  
    1 from interfaces import IFaculty, IDepartment
    2 from facultycontainer import FacultyContainer
    3 from faculty import Faculty
    4 from department import Department
     1# $Id$
     2#from interfaces import *
     3#from course import Course
     4#from department import Department
     5#from faculty import Faculty
     6#from permissions import *
  • waeup/branches/hraban/src/waeup/university/certificate.py

    • Property svn:keywords set to Id
    r3526 r3737  
     1# $Id$
  • waeup/branches/hraban/src/waeup/university/course.py

    • Property svn:keywords set to Id
    r3571 r3737  
     1# $Id$
    12import grok
    23import waeup.baseitem as base
     4from waeup.university import permissions
    35from waeup.university.interfaces import ICourse
    46
    5 class Course(grok.Model):
     7class Course(base.BaseItem):
     8    """
     9    This is a Course (part of Department)
     10    """
    611    grok.implements(ICourse)
    712    name = u'Course'
     13    plural_name = u'Courses'
     14    ViewPermission = permissions.ViewCourse
     15    AddPermission = permissions.AddCourse
     16    EditPermission = permissions.EditCourse
  • waeup/branches/hraban/src/waeup/university/department.py

    • Property svn:keywords set to Id
    r3571 r3737  
     1# -*- coding: utf-8 -*-
     2# $Id$
    13import grok
    24import waeup.basecontainer as base
     5from waeup.university import permissions
    36from waeup.university.interfaces import IDepartment
    47from waeup.university.course import Course
     8#from waeup.university.containers import CourseContainer
    59
    610class Department(base.BaseContainer):
     11    """
     12    This is a Department (part of Faculty, contains Courses)
     13    """
    714    grok.implements(IDepartment)
    815    childClass = Course
    916    name = u'Department'
     17    plural_name = u'Departments'
     18    ViewPermission = permissions.ViewDepartment
     19    AddPermission = permissions.AddDepartment
     20    EditPermission = permissions.EditDepartment
    1021
    11 #class Add(base.AddViewlet):
    12 #    grok.context(IDepartment)
     22    def __init__(self, **kw):
     23        super(Department, self).__init__(**kw)
     24        self.__dict__.update(kw)
    1325
     26# Bei BaseContainer-Klassen müsen die beiden Viewlets ans Interface angepasst werden:
    1427
    15 #class Edit(base.EditViewlet):
    16 #    grok.context(IDepartment)
     28class DisplayViewlet(base.DisplayViewlet):
     29    grok.context(IDepartment)
     30   
     31class AddViewlet(base.AddViewlet):
     32    grok.context(IDepartment)
  • waeup/branches/hraban/src/waeup/university/faculty.py

    • Property svn:keywords set to Id
    r3566 r3737  
     1# -*- coding: utf-8 -*-
     2# $Id$
    13import grok
    24import waeup.basecontainer as base
     5from waeup.interfaces import IBaseContainer
     6from waeup.university import permissions
    37from waeup.university.interfaces import IFaculty
    48from waeup.university.department import Department
     
    1115    childClass = Department
    1216    name = u'Faculty'
     17    plural_name = u'Faculties'
     18    ViewPermission = permissions.ViewFaculty
     19    AddPermission = permissions.AddFaculty
     20    EditPermission = permissions.EditFaculty
    1321
    14 #class Add(base.AddViewlet):
    15 #    grok.context(IFaculty)
    16 
    17 #class Edit(base.Edit):
    18 #    grok.context(IFaculty)
     22    def __init__(self, **kw):
     23        super(Faculty, self).__init__(**kw)
     24        self.__dict__.update(kw)
     25   
     26# Bei BaseContainer-Klassen müsen die beiden Viewlets ans Interface angepasst werden:
     27   
     28class DisplayViewlet(base.DisplayViewlet):
     29    grok.context(IFaculty)
     30   
     31class AddViewlet(base.AddViewlet):
     32    grok.context(IFaculty)
  • waeup/branches/hraban/src/waeup/university/facultycontainer.py

    • Property svn:keywords set to Id
    r3571 r3737  
     1# $Id$
    12import grok
    23from waeup.basecontainer import BaseContainer
    34from waeup.interfaces import IBaseContainer
    4 from waeup.university.interfaces import IFaculty
    55from waeup.university.faculty import Faculty
    66
  • waeup/branches/hraban/src/waeup/university/interfaces.py

    • Property svn:keywords set to Id
    r3571 r3737  
     1# $Id$
    12import grok
    23import re
    34from zope import schema
    4 from waeup.interfaces import IBaseContainer
     5from waeup.interfaces import IBaseContainer, IBaseItem
    56
    67class IFaculty(grok.interfaces.IContainer):
     
    4647
    4748
    48 class ICourse(IBaseContainer):
     49class ICourse(IBaseItem):
    4950    """Representation of a study course, provided by a department.
    5051    """
  • waeup/branches/hraban/src/waeup/utils/__init__.py

    • Property svn:keywords set to Id
    r3527 r3737  
     1# $Id$
  • waeup/branches/hraban/src/waeup/utils/importexport.py

    • Property svn:keywords set to Id
    r3529 r3737  
     1# $Id$
    12import csv
    23
  • waeup/branches/hraban/src/waeup/viewlets.py

    • Property svn:keywords set to Id
    r3566 r3737  
    11# -*- coding: utf-8 -*-
    2 # viewlets.py
     2# $Id$
    33import grok
    44from grok.interfaces import IContainer
  • waeup/branches/hraban/src/waeup/viewlets_templates/appcss.pt

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/viewlets_templates/authuser.pt

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/viewlets_templates/copyright.pt

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/viewlets_templates/edit_form.pt

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/viewlets_templates/login.pt

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/viewlets_templates/logo.pt

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/viewlets_templates/master.pt

    • Property svn:keywords set to Id
  • waeup/branches/hraban/src/waeup/viewlets_templates/navigationbar.pt

    • Property svn:keywords set to Id
    r3562 r3737  
    11<div id="adminbar" class="menubar"
    22    tal:define="app view/getSite">
    3 <!--    <ul>
    4                 <tal:block  tal:repeat="menuitem view/menuitems">
    5                         <li><a tal:attributes="href menuitem/url;title menuitem/title" tal:content="menuitem/text">Menuitem</a></li>
    6                 </tal:block>
    7         </ul>-->
    83  <ul>
    94        <li><a tal:attributes="href view/application_url">Home</a></li>
    10     <li tal:repeat="fac app/values">
     5    <li tal:repeat="item app/values">
    116      <a href="."
    12          tal:content="fac/name"
    13          tal:attributes="href python:view.url(fac)" />
     7         tal:content="item/name"
     8         tal:attributes="href python:view.url(item)" />
    149    </li>
    1510  </ul>
  • waeup/branches/hraban/src/waeup/viewlets_templates/title.pt

    • Property svn:keywords set to Id
Note: See TracChangeset for help on using the changeset viewer.