Ignore:
Timestamp:
28 Nov 2011, 21:42:28 (13 years ago)
Author:
Henrik Bettermann
Message:

Use new principal attributes in contact form pages (applicants not yet ready).

(And some missing things from last checkin).

Location:
main/waeup.sirp/trunk/src/waeup/sirp/browser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt

    r7233 r7234  
    4545  >>> print browser.contents
    4646  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
    47   ...>Required input is missing...
     47  ...Required input is missing...
    4848  ...
    4949
     
    187187  ...
    188188
    189 We fill the form and try to send message to contact@waeup.org)::
     189We fill the form  (this will send a real message to
     190contact@waeup.org)::
    190191
    191192  >>> browser.open('http://localhost/myuniversity/contactadmin')
     
    194195  >>> print browser.contents
    195196  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
    196   ...<li class="message">You don't have a user account.</li>
    197   ...
    198 
    199 We can't send messages without a user account.
     197  ...<li class="message">Your message has been sent.</li>
     198  ...
     199
     200If this test fails, chances are, that the local machine has no SMTP
     201server installed.
     202
    200203
    201204
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r7233 r7234  
    216216    @grok.action('Send message now')
    217217    def send(self, *args, **data):
    218         useraccount = self.get_user_account
    219         if useraccount is None:
    220             self.flash("You don't have a user account.")
    221             return
    222         fullname = useraccount.title
    223         email_from = useraccount.email
    224         username = useraccount.name
     218        fullname = self.request.principal.title
     219        try:
     220            email_from = self.request.principal.email
     221        except AttributeError:
     222            email_from = self.config.email_admin
     223        username = self.request.principal.id
    225224        body = data['body']
    226225        email_to = self.config.email_admin
     
    462461    @grok.action('Send message now')
    463462    def send(self, *args, **data):
    464         useraccount = self.get_user_account
    465         if useraccount is None:
    466             self.flash("You don't have a user account.")
    467             return
    468         fullname = useraccount.title
    469         email_from = useraccount.email
    470         username = useraccount.name
     463        fullname = self.request.principal.title
     464        try:
     465            email_from = self.request.principal.email
     466        except AttributeError:
     467            email_from = self.config.email_admin
     468        username = self.request.principal.id
    471469        body = data['body']
    472470        email_to = self.context.email
Note: See TracChangeset for help on using the changeset viewer.