Changeset - 6d44d3862ec4
[Not reviewed]
default
0 3 0
Marcin Kuzminski - 15 years ago 2010-09-30 12:44:06
marcin@python-works.com
fixes #36, removed username, name, lastname, minimal length restrictions,
fixed branches/tags icons in changelog and made them active links
3 files changed with 20 insertions and 18 deletions:
0 comments (0 inline, 0 general)
pylons_app/model/forms.py
Show inline comments
 
@@ -226,126 +226,126 @@ def UniqSystemEmail(old_data):
 
        
 
    return _UniqSystemEmail
 
    
 
class ValidSystemEmail(formencode.validators.FancyValidator):
 
    def to_python(self, value, state):
 
        sa = meta.Session
 
        try:
 
            user = sa.query(User).filter(User.email == value).scalar()
 
            if  user is None:
 
                raise formencode.Invalid(_("That e-mail address doesn't exist.") ,
 
                                         value, state)
 
        finally:
 
            meta.Session.remove()
 
            
 
        return value     
 

	
 
#===============================================================================
 
# FORMS        
 
#===============================================================================
 
class LoginForm(formencode.Schema):
 
    allow_extra_fields = True
 
    filter_extra_fields = True
 
    username = UnicodeString(
 
                             strip=True,
 
                             min=3,
 
                             min=1,
 
                             not_empty=True,
 
                             messages={
 
                                       'empty':_('Please enter a login'),
 
                                       'tooShort':_('Enter a value %(min)i characters long or more')}
 
                            )
 

	
 
    password = UnicodeString(
 
                            strip=True,
 
                            min=3,
 
                            min=8,
 
                            not_empty=True,
 
                            messages={
 
                                      'empty':_('Please enter a password'),
 
                                      'tooShort':_('Enter a value %(min)i characters long or more')}
 
                                )
 

	
 

	
 
    #chained validators have access to all data
 
    chained_validators = [ValidAuth]
 
    
 
def UserForm(edit=False, old_data={}):
 
    class _UserForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = True
 
        username = All(UnicodeString(strip=True, min=3, not_empty=True), ValidUsername(edit, old_data))
 
        username = All(UnicodeString(strip=True, min=1, not_empty=True), ValidUsername(edit, old_data))
 
        if edit:
 
            new_password = All(UnicodeString(strip=True, min=3, not_empty=False), ValidPassword)
 
            new_password = All(UnicodeString(strip=True, min=8, not_empty=False), ValidPassword)
 
            admin = StringBoolean(if_missing=False)
 
        else:
 
            password = All(UnicodeString(strip=True, min=8, not_empty=True), ValidPassword)
 
        active = StringBoolean(if_missing=False)
 
        name = UnicodeString(strip=True, min=3, not_empty=True)
 
        lastname = UnicodeString(strip=True, min=3, not_empty=True)
 
        name = UnicodeString(strip=True, min=1, not_empty=True)
 
        lastname = UnicodeString(strip=True, min=1, not_empty=True)
 
        email = All(Email(not_empty=True), UniqSystemEmail(old_data))
 
        
 
    return _UserForm
 

	
 
RegisterForm = UserForm
 

	
 
def PasswordResetForm():
 
    class _PasswordResetForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = True
 
        email = All(ValidSystemEmail(), Email(not_empty=True))             
 
    return _PasswordResetForm
 

	
 
def RepoForm(edit=False, old_data={}):
 
    class _RepoForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        repo_name = All(UnicodeString(strip=True, min=1, not_empty=True), ValidRepoName(edit, old_data))
 
        description = UnicodeString(strip=True, min=3, not_empty=True)
 
        description = UnicodeString(strip=True, min=1, not_empty=True)
 
        private = StringBoolean(if_missing=False)
 
        
 
        if edit:
 
            user = All(Int(not_empty=True), ValidRepoUser)
 
        
 
        chained_validators = [ValidPerms]
 
    return _RepoForm
 

	
 
def RepoSettingsForm(edit=False, old_data={}):
 
    class _RepoForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        repo_name = All(UnicodeString(strip=True, min=1, not_empty=True), ValidRepoName(edit, old_data))
 
        description = UnicodeString(strip=True, min=3, not_empty=True)
 
        description = UnicodeString(strip=True, min=1, not_empty=True)
 
        private = StringBoolean(if_missing=False)
 
        
 
        chained_validators = [ValidPerms, ValidSettings]
 
    return _RepoForm
 

	
 

	
 
def ApplicationSettingsForm():
 
    class _ApplicationSettingsForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        hg_app_title = UnicodeString(strip=True, min=3, not_empty=True)
 
        hg_app_realm = UnicodeString(strip=True, min=3, not_empty=True)
 
        hg_app_title = UnicodeString(strip=True, min=1, not_empty=True)
 
        hg_app_realm = UnicodeString(strip=True, min=1, not_empty=True)
 
        
 
    return _ApplicationSettingsForm
 
 
 
def ApplicationUiSettingsForm():
 
    class _ApplicationUiSettingsForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        web_push_ssl = OneOf(['true', 'false'], if_missing='false')
 
        paths_root_path = All(ValidPath(), UnicodeString(strip=True, min=3, not_empty=True))
 
        paths_root_path = All(ValidPath(), UnicodeString(strip=True, min=1, not_empty=True))
 
        hooks_changegroup_update = OneOf(['True', 'False'], if_missing=False)
 
        hooks_changegroup_repo_size = OneOf(['True', 'False'], if_missing=False)
 
        
 
    return _ApplicationUiSettingsForm
 

	
 
def DefaultPermissionsForm(perms_choices, register_choices, create_choices):
 
    class _DefaultPermissionsForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = True
 
        overwrite_default = OneOf(['true', 'false'], if_missing='false')
 
        default_perm = OneOf(perms_choices)
 
        default_register = OneOf(register_choices)
 
        default_create = OneOf(create_choices)
 
        
 
    return _DefaultPermissionsForm
pylons_app/public/css/style.css
Show inline comments
 
@@ -3131,49 +3131,49 @@ h3.files_location{
 
	width: 160px;
 
	float: left;
 
	margin-left:-50px;
 
	margin-top: 5px;
 
}
 
 
#graph_content {
 
	width: 800px;
 
	float: left;
 
}
 
 
#graph_content .container_header {
 
	border: 1px solid #CCCCCC;
 
	padding:10px;
 
}
 
 
#graph_content .container .wrapper {
 
	width: 600px;
 
}
 
 
#graph_content .container {
 
	border-bottom: 1px solid #CCCCCC;
 
	border-left: 1px solid #CCCCCC;
 
	border-right: 1px solid #CCCCCC;
 
	min-height: 90px;
 
	min-height: 80px;
 
	overflow: hidden;
 
	font-size:1.2em;	
 
}
 
 
#graph_content .container .left {
 
	float: left;
 
	width: 70%;
 
	padding-left: 5px;
 
}
 
 
#graph_content .container .right {
 
	float: right;
 
	width: 25%;
 
	text-align: right;
 
}
 
 
#graph_content .container .left .date {
 
	font-weight: bold;
 
}
 
 
#graph_content .container .left .author {
 
	
 
}
 
 
@@ -3202,56 +3202,56 @@ h3.files_location{
 
.right .changes .changed {
 
	background: #FFDD88;
 
}
 
 
.right .changes .removed {
 
	background: #FF8888;
 
}
 
 
.right .merge {
 
	vertical-align: top;
 
	font-size: 60%;
 
	font-weight: bold;
 
}
 
 
.right .merge img {
 
	vertical-align: bottom;
 
}
 
 
.right .parent {
 
	font-size: 90%;
 
	font-family: monospace;
 
}
 
 
.right .logtags .branchtag{
 
	background: #FFFFFF url("../images/icons/arrow_branch.png") no-repeat 130px 9px;
 
	background: #FFFFFF url("../images/icons/arrow_branch.png") no-repeat right 9px;
 
    display:block;
 
    padding:12px 2px 2px 24px;
 
    padding:12px 16px 0px 0px
 
}
 
.right .logtags .tagtag{
 
    background: #FFFFFF url("../images/icons/tag_blue.png") no-repeat 130px 9px;
 
    background: #FFFFFF url("../images/icons/tag_blue.png") no-repeat right 9px;
 
    display:block;
 
    padding:12px 2px 2px 24px;
 
    padding:12px 18px 0px 0px
 
}
 
 
/* -----------------------------------------------------------
 
	FILE BROWSER
 
----------------------------------------------------------- */
 
div.browserblock {
 
	overflow: hidden;
 
	padding: 0px;
 
	border: 1px solid #ccc;
 
	background: #f8f8f8;
 
	font-size: 100%;
 
	line-height: 100%;
 
	/* new */
 
	line-height: 125%;
 
}
 
 
div.browserblock .browser-header {
 
	border-bottom: 1px solid #CCCCCC;
 
	background: #FFFFFF;
 
	color: blue;
 
	padding: 10px 0 10px 0;
 
}
 
 
div.browserblock .browser-header span {
pylons_app/templates/changelog/changelog.html
Show inline comments
 
@@ -55,51 +55,53 @@
 
								<span><a href="mailto:${h.email_or_none(cs.author)}">${h.email_or_none(cs.author)}</a></span><br/>
 
							</div>
 
							<div class="message">
 
								${h.link_to(h.wrap_paragraphs(cs.message),
 
								h.url('changeset_home',repo_name=c.repo_name,revision=cs.short_id))}
 
							</div>
 
						</div>	
 
						<div class="right">
 
									<div class="changes">
 
										<span class="removed" title="${_('removed')}">${len(cs.removed)}</span>
 
										<span class="changed" title="${_('changed')}">${len(cs.changed)}</span>
 
										<span class="added" title="${_('added')}">${len(cs.added)}</span>
 
									</div>					
 
										%if len(cs.parents)>1:
 
										<div class="merge">
 
											${_('merge')}<img alt="merge" src="/images/icons/arrow_join.png"/>
 
										</div>
 
										%endif						
 
									%for p_cs in reversed(cs.parents):
 
										<div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(p_cs.short_id,
 
											h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.short_id),title=p_cs.message)}
 
										</div>
 
									%endfor
 
								<span class="logtags">
 
									<span class="branchtag">${cs.branch}</span>
 
									<span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}">
 
									${h.link_to(cs.branch,h.url('files_home',repo_name=c.repo_name,revision=cs.short_id))}</span>
 
									%for tag in cs.tags:
 
										<span class="tagtag">${tag}</span>
 
										<span class="tagtag"  title="${'%s %s' % (_('tag'),tag)}">
 
										${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=cs.short_id))}</span>
 
									%endfor
 
								</span>																	
 
						</div>				
 
					</div>
 
					
 
				%endfor
 
				<div class="pagination-wh pagination-left">
 
					${c.pagination.pager('$link_previous ~2~ $link_next')}
 
				</div>			
 
				</div>
 
			</div>
 
			
 
			<script type="text/javascript" src="/js/graph.js"></script>
 
			<script type="text/javascript">
 
				YAHOO.util.Event.onDOMReady(function(){
 
					function set_canvas() {
 
						var c = document.getElementById('graph_nodes');
 
						var t = document.getElementById('graph_content');
 
						canvas = document.getElementById('graph_canvas');
 
						var div_h = t.clientHeight;
 
						c.style.height=div_h+'px';
 
						canvas.setAttribute('height',div_h);
 
						canvas.setAttribute('width',160);
 
					};
0 comments (0 inline, 0 general)