Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ptahproject/ptahcrowd
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: djedproject/ptahcrowd
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 7 commits
  • 27 files changed
  • 1 contributor

Commits on Dec 12, 2014

  1. remove python 2 support

    sidloki committed Dec 12, 2014
    Copy the full SHA
    47033de View commit details
  2. use djed packages

    sidloki committed Dec 12, 2014
    Copy the full SHA
    6803449 View commit details
  3. update travis config

    sidloki committed Dec 12, 2014
    Copy the full SHA
    a8065e8 View commit details

Commits on Dec 23, 2014

  1. update mail

    sidloki committed Dec 23, 2014
    Copy the full SHA
    5b7a5bc View commit details
  2. add admin-email setting

    sidloki committed Dec 23, 2014
    Copy the full SHA
    812c945 View commit details

Commits on Dec 24, 2014

  1. update mail usage

    sidloki committed Dec 24, 2014
    Copy the full SHA
    4c6045c View commit details
  2. update layout usage

    sidloki committed Dec 24, 2014
    Copy the full SHA
    673e63c View commit details
13 changes: 9 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
language: python
python:
- 2.6
- 2.7
- 3.3
- 3.4

install:
- pip install -e git+git://github.com/ptahproject/ptah#egg=ptah
- pip install -e git+git://github.com/djedproject/djed.mail#egg=djed.mail
- pip install -e git+git://github.com/djedproject/djed.templates#egg=djed.templates
- pip install -e git+git://github.com/djedproject/djed.layout#egg=djed.layout
- pip install -e git+git://github.com/djedproject/djed.static#egg=djed.static
- pip install -e git+git://github.com/djedproject/djed.message#egg=djed.message
- pip install -e git+git://github.com/djedproject/djed.form#egg=djed.form
- pip install -e git+git://github.com/djedproject/djed.formatter#egg=djed.formatter
- pip install -e git+git://github.com/djedproject/ptah#egg=ptah
- python setup.py develop --allow-hosts='pypi.python.org'

script: python setup.py test

notifications:
irc: "irc.freenode.org#ptahproject"
email: false
8 changes: 2 additions & 6 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -7,20 +7,16 @@ CHANGES

- Added python 3.3 and 3.4 support

- Removed python 3.2 support
- Removed python 3.2 and python 2 support

- Added user defaults validated and suspended

- Added possibility to login with username and email
- Added possibility to login with username or email

- Changed CrowdUser model columns:
- `name` to `fullname`
- `login` to `username`

- Use `ptah.renderer`

- Use `ptah.form`


0.2 (2012-11-08)
----------------
10 changes: 6 additions & 4 deletions ptahcrowd/forbidden.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
""" forbidden view """
import ptah.renderer
from pyramid.compat import url_encode
from pyramid import security
from pyramid.response import Response
@@ -16,7 +15,9 @@

@view_config(
context=HTTPForbidden,
renderer=ptah.renderer.layout('ptahcrowd:templates/forbidden.pt', 'ptahcrowd'))
renderer='ptahcrowd:templates/forbidden.pt',
layout='ptahcrowd'
)
class Forbidden(ptah.View):

def update(self):
@@ -59,8 +60,9 @@ def update(self):
response.headers['location'] = location
return response

PTAH = ptah.get_settings(ptah.CFG_ID_PTAH, self.request.registry)
self.email_address = PTAH['email_from_address']
sender = ptah.mail.parseaddr(
self.request.registry.settings['mail.default_sender'])
self.email_address = sender[1]

self.request.response.status = HTTPForbidden.code

22 changes: 13 additions & 9 deletions ptahcrowd/login.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
""" login form """
import ptah
import ptah.form
import ptah.renderer
from pyramid import security
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
@@ -13,7 +11,9 @@

@view_config(
route_name='ptahcrowd-login',
renderer=ptah.renderer.layout('ptahcrowd:login.lt', 'ptahcrowd'))
renderer='ptahcrowd:login.lt',
layout='ptahcrowd'
)
class LoginForm(ptah.form.Form, ptah.View):
""" Login form """

@@ -103,7 +103,9 @@ def update(self):

@view_config(
route_name='ptahcrowd-login-success',
renderer=ptah.renderer.layout('ptahcrowd:login-success.lt', 'ptahcrowd'))
renderer='ptahcrowd:login-success.lt',
layout='ptahcrowd'
)
class LoginSuccess(ptah.View):
""" Login successful information page. """

@@ -122,7 +124,9 @@ def update(self):

@view_config(
route_name='ptahcrowd-login-suspended',
renderer=ptah.renderer.layout('ptahcrowd:login-suspended.lt', 'ptahcrowd'))
renderer='ptahcrowd:login-suspended.lt',
layout='ptahcrowd'
)
class LoginSuspended(ptah.View):
""" Suspended account information page. """

@@ -134,10 +138,10 @@ def update(self):
if not principal.suspended:
return HTTPFound(location=self.request.application_url)

MAIL = ptah.get_settings(ptah.CFG_ID_PTAH)
self.from_name = MAIL['email_from_name']
self.from_address = MAIL['email_from_address']
self.full_address = MAIL['full_email_address']
self.full_address = self.request.registry.settings['mail.default_sender']
sender = ptah.mail.parseaddr(self.full_address)
self.from_name = sender[0]
self.from_address = sender[1]


@view_config(route_name='ptahcrowd-logout')
2 changes: 1 addition & 1 deletion ptahcrowd/populate.py
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ def create_admin_user(registry):
user = tinfo.create(
fullname=crowd_cfg['admin-name'],
username=crowd_cfg['admin-login'],
email=ptah_cfg['email_from_address'])
email=crowd_cfg['admin-email'])
user.password = ptah.pwd_tool.encode(crowd_cfg['admin-password'])
user.validated = True
user.suspended = False
1 change: 0 additions & 1 deletion ptahcrowd/provider.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
from datetime import datetime
from pyramid.compat import text_type

import ptah.form
import ptah
from ptah.password import passwordValidator
from ptahcrowd.settings import CFG_ID_CROWD
12 changes: 7 additions & 5 deletions ptahcrowd/providers/__init__.py
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@
import logging
import sqlalchemy as sqla
from datetime import datetime, timedelta
import ptah.form
import ptah.renderer
from pyramid import security
from pyramid.view import view_config
from pyramid.config import Configurator
@@ -97,7 +95,8 @@ def login(uri, request):

@view_config(
route_name='ptahcrowd-verify-email',
renderer=ptah.renderer.layout('', 'pthacrowd'))
layout='pthacrowd'
)
class VerifyEmail(ptah.form.Form):
""" verify email """

@@ -169,7 +168,7 @@ def verify_handler(self):
'uid': entry.uid}

t = ptah.token.service.generate(TOKEN_TYPE, json.dumps(data))
template = VerifyTemplate(entry, request, email=email, token=t)
template = VerifyTemplate(request, principal=entry, token=t)
template.send()

# login
@@ -228,7 +227,10 @@ def update(self):

self.url = self.request.route_url(
'ptahcrowd-verify-email-complete', subpath=(self.token,))
self.to_address = ptah.mail.formataddr((self.context.name, self.email))

self.recipients = [ptah.mail.formataddr(
(self.principal.name, self.principal.email)
)]


class AuthenticationComplete(object):
9 changes: 4 additions & 5 deletions ptahcrowd/registration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
""" user registration form """
import ptah.form
import ptah.renderer
from pyramid import security
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound, HTTPForbidden
@@ -17,8 +15,9 @@

@view_config(
route_name='ptahcrowd-join',
renderer=ptah.renderer.layout('ptahcrowd:registration.lt', 'ptahcrowd'))

renderer='ptahcrowd:registration.lt',
layout='ptahcrowd'
)
class Registration(ptah.form.Form):
""" Ptah crowd registration form """

@@ -60,7 +59,7 @@ def register_handler(self):
self.cfg = ptah.get_settings(CFG_ID_CROWD, self.request.registry)
# validation
if self.cfg['validation']:
initiate_email_validation(user.email, user, self.request)
initiate_email_validation(user, self.request)
self.request.add_message('Validation email has been sent.')
if not self.cfg['allow-unvalidated']:
return HTTPFound(location=self.request.application_url)
27 changes: 15 additions & 12 deletions ptahcrowd/resetpassword.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
""" reset password form """
import ptah.form
import ptah.renderer
from datetime import datetime
from pyramid import security
from pyramid.view import view_config
@@ -19,8 +17,9 @@

@view_config(
route_name='ptahcrowd-resetpassword',
renderer=ptah.renderer.layout('ptahcrowd:resetpassword.lt', 'ptahcrowd'))

renderer='ptahcrowd:resetpassword.lt',
layout='ptahcrowd'
)
class ResetPassword(ptah.form.Form):

fields = ResetPasswordSchema
@@ -30,8 +29,10 @@ def form_content(self):

def update(self):
cfg = ptah.get_settings(ptah.CFG_ID_PTAH, self.request.registry)
self.from_name = cfg['email_from_name']
self.from_address = cfg['email_from_address']
sender = ptah.mail.parseaddr(
self.request.registry.settings['mail.default_sender'])
self.from_name = sender[0]
self.from_address = sender[1]

return super(ResetPassword, self).update()

@@ -50,7 +51,7 @@ def reset(self):
passcode = ptah.pwd_tool.generate_passcode(principal)

template = ResetPasswordTemplate(
principal, request, passcode=passcode)
request, principal=principal, passcode=passcode)
template.send()

self.request.registry.notify(
@@ -68,8 +69,9 @@ def cancel(self):

@view_config(
route_name='ptahcrowd-resetpassword-form',
renderer=ptah.renderer.layout('ptahcrowd:resetpasswordform.lt', 'ptahcrowd'))

renderer='ptahcrowd:resetpasswordform.lt',
layout='ptahcrowd'
)
class ResetPasswordForm(ptah.form.Form):

fields = PasswordSchema
@@ -153,7 +155,8 @@ def update(self):
self.url = '%s/resetpassword.html/%s/' % (
request.application_url, self.passcode)

info = self.context

self.to_address = ptah.mail.formataddr((info.name, info.email))
self.recipients = [ptah.mail.formataddr(
(self.principal.name, self.principal.email)
)]

self.from_name = ptah.mail.parseaddr(self.sender)[0]
1 change: 0 additions & 1 deletion ptahcrowd/schemas.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
""" schemas """
import ptah.form
from pyramid.compat import string_types

import ptah
7 changes: 6 additions & 1 deletion ptahcrowd/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ptah
import ptah.form
import translationstring

_ = translationstring.TranslationStringFactory('ptahcrowd')
@@ -81,6 +80,12 @@
description = 'Default admin login.',
default = ''),

ptah.form.TextField(
'admin-email',
title = 'Admin email',
description = 'Default admin email.',
default = 'admin@localhost'),

ptah.form.TextField(
'admin-password',
title = 'Admin password',
2 changes: 1 addition & 1 deletion ptahcrowd/templates/login.pt
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
<a href="${view.joinurl}" i18n:translate="">head over to the registration form.</a>
</p>

${structure: request.render_tmpl(view.tmpl_view, view)}
${structure: request.render_template(view.tmpl_view, view)}
</div>


2 changes: 1 addition & 1 deletion ptahcrowd/templates/registration.pt
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
<h1 i18n:translate="">Registration</h1>
</div>

${structure: request.render_tmpl(view.tmpl_view, view)}
${structure: request.render_template(view.tmpl_view, view)}

</div>
</tal:block>
2 changes: 1 addition & 1 deletion ptahcrowd/templates/resetpassword.pt
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@
<p i18n:translate="">If this will not work for you (for example, if you forgot your member name or your email address has changed) send an email to <a href="${'mailto:%s'%view.from_address}" i18n:name="link">${view.from_name}</a>.
</p>

<tal:block content="structure request.render_tmpl(view.tmpl_view, view)" />
<tal:block content="structure request.render_template(view.tmpl_view, view)" />
</tal:block>
2 changes: 1 addition & 1 deletion ptahcrowd/templates/resetpasswordform.pt
Original file line number Diff line number Diff line change
@@ -4,5 +4,5 @@
<p tal:condition="view.passcode" i18n:translate="">Password reset confirmation for <span tal:replace="view.principal" i18n:name="user" /></p>
</div>

<tal:block content="structure request.render_tmpl(view.tmpl_view, view)" />
<tal:block content="structure request.render_template(view.tmpl_view, view)" />
</tal:block>
8 changes: 4 additions & 4 deletions ptahcrowd/templates/resetpasswordmail.pt
Original file line number Diff line number Diff line change
@@ -3,13 +3,13 @@
The password resetting process has been initiated. You must visit the link
below to complete it:</tal:block>

<tal:block tal:content="view.url" />
<tal:block tal:content="url" />

--
<tal:block i18n:translate="">Requested by IP
<span tal:replace="view.from_ip" i18n:name="ip" /> on
<span tal:replace="view.date" i18n:name="date" /></tal:block>
<span tal:replace="from_ip" i18n:name="ip" /> on
<span tal:replace="date" i18n:name="date" /></tal:block>

--
<tal:block tal:content="view.from_name" />
<tal:block tal:content="from_name" />
</tal:block>
4 changes: 2 additions & 2 deletions ptahcrowd/templates/users.pt
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@
<td>${user.email}</td>
<td tal:content="user.validated"></td>
<td tal:content="user.suspended"></td>
<td>${request.fmt.datetime(user.joined, 'short')}</td>
<td>${request.format.datetime(user.joined, 'short')}</td>
<td>
<tal:block repeat="item view.external.get(user.__uri__,())">
<img src="${request.static_url('ptahcrowd:static/buttons/%s_32.png'%item)}"
@@ -82,6 +82,6 @@
<h3>Search users</h3>
</div>

${structure: request.render_tmpl(view.tmpl_view, view)}
${structure: request.render_template(view.tmpl_view, view)}

</tal:block>
2 changes: 1 addition & 1 deletion ptahcrowd/templates/validate_email.txt
Original file line number Diff line number Diff line change
@@ -3,6 +3,6 @@ Hi!
You're close to completing the registration process. Once you click this link,
your login and password will be activated.

${view.url}
${url}

Thanks!
2 changes: 1 addition & 1 deletion ptahcrowd/templates/verify_email.txt
Original file line number Diff line number Diff line change
@@ -3,6 +3,6 @@ Hi!
You're close to completing the registration process. Once you click this link,
your account will be activated.

${view.url}
${url}

Thanks!
Loading