Skip to content

Commit

Permalink
- Adjustments to utf8 encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
frankyrumple committed Jul 30, 2019
1 parent 55fe468 commit 6541fae
Show file tree
Hide file tree
Showing 24 changed files with 106 additions and 10 deletions.
2 changes: 1 addition & 1 deletion web2py/applications/smc/controllers/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# coding: utf8
# -*- coding: utf-8 -*-

import sys
import os
Expand Down
2 changes: 1 addition & 1 deletion web2py/applications/smc/controllers/faculty.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# coding: utf8
# -*- coding: utf-8 -*-


from ednet import AD
Expand Down
3 changes: 2 additions & 1 deletion web2py/applications/smc/controllers/import.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# coding: utf8
# -*- coding: utf-8 -*-

from ednet.util import Util
from ednet.ad import AD
from ednet.student import Student
Expand Down
2 changes: 2 additions & 0 deletions web2py/applications/smc/controllers/lms.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

import sys
import os
import subprocess
Expand Down
1 change: 1 addition & 0 deletions web2py/applications/smc/controllers/media.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-

import os
import tempfile
import time
Expand Down
64 changes: 63 additions & 1 deletion web2py/applications/smc/controllers/student.py
Original file line number Diff line number Diff line change
@@ -1 +1,63 @@
# coding: utf8from ednet import Studentfrom ednet import AD@auth.requires_membership('Students')def changepassword(): form = SQLFORM.factory( Field('old_password', 'password'), Field('new_password', 'password', requires=[IS_NOT_EMPTY(),IS_STRONG(min=6, special=1, upper=1, error_message='minimum 6 characters, and at least 1 uppercase character, 1 lower case character, 1 number, and 1 special character')]), Field('confirm_new_password', 'password', requires=IS_EXPR('value==%s' % repr(request.vars.get('new_password', None)), error_message="Password fields don't match")), submit_button="Change Password").process() user_id="empty" user_id =Student.GetUserIDFromUsername(auth.user.username) if (form.accepted): old_pw = request.vars.get('old_password') pw = request.vars.get('new_password', '') user_id = Student.GetUserIDFromUsername(auth.user.username) curr_password = Student.GetPassword(user_id) if (curr_password != old_pw): response.flash = "Incorrect old password!" elif (pw != ""): ret = Student.SetPassword(user_id, pw) if (ret != ""): response.flash = ret else: response.flash = "Password Changed." # + ret + " - " + AD.GetErrorString() elif (form.errors): response.flash = "Unable to set new password" return dict(form=form)@auth.requires_membership('Students')def index(): ret = "" return dict(message=ret) def guidtest(): from ednet import SequentialGUID l = list() l.append("GUID AS STRING") l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING)) l.append("GUID AT END") l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END)) l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END)) return locals()
# -*- coding: utf-8 -*-

from ednet.student import Student
# from ednet.ad import AD


def index():
ret = ""
return dict(message=ret)


@auth.requires_membership('Students')
def changepassword():
# response.view = "student/changepassword.html"
form = SQLFORM.factory(
Field('old_password', 'password'),
Field('new_password', 'password', requires=[IS_NOT_EMPTY(), IS_STRONG(min=6, special=1, upper=1,
error_message='minimum 6 characters, and at least 1 uppercase character, 1 lower case character, 1 number, and 1 special character')]),
Field('confirm_new_password', 'password', requires=IS_EXPR('value==%s' % repr(request.vars.get('new_password', None)),
error_message="Password fields don't match")),
submit_button="Change Password").process()
user_id = "empty"
user_id = Student.GetUserIDFromUsername(auth.user.username)
if form.accepted:
old_pw = request.vars.get('old_password')
pw = request.vars.get('new_password', '')
user_id = Student.GetUserIDFromUsername(auth.user.username)
curr_password = Student.GetPassword(user_id)
if curr_password != old_pw:
response.flash = "Incorrect old password!"
elif pw != "":
ret = Student.SetPassword(user_id, pw)
if ret != "":
response.flash = ret
else:
response.flash = "Password Changed." # + ret + " - " + AD.GetErrorString()
elif form.errors:
response.flash = "Unable to set new password"
return dict(form=form)


def guidtest():
from ednet.sequentialguid import SequentialGUID
l = list()
l.append("GUID AS STRING")
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AS_STRING))
l.append("GUID AT END")
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END))
l.append(SequentialGUID.NewGUID(SequentialGUID.SEQUENTIAL_GUID_AT_END))
return locals()
1 change: 1 addition & 0 deletions web2py/applications/smc/controllers/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-

# try something like

#from ednet.ad import AD
Expand Down
3 changes: 3 additions & 0 deletions web2py/applications/smc/models/a_syspath.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

# Make sure web2py reloads modules
from gluon.custom_import import track_changes
track_changes(True)
Expand All @@ -23,6 +25,7 @@
os.path.dirname(os.path.abspath(__file__))))))
bat_path = os.path.join(curr_path, "kill_smc.bat")
if os.path.exists(bat_path) is not True:
print("Writing " + str(bat_path))
f = open(bat_path, 'w')
f.write("@echo off\r\ntaskkill /f /pid ")
f.write(str(os.getpid()))
Expand Down
2 changes: 2 additions & 0 deletions web2py/applications/smc/models/b_media_code.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

"""
Functions/helpers for media files, helps minimize the footprint of the media controller file
"""
Expand Down
2 changes: 1 addition & 1 deletion web2py/applications/smc/models/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@

## create all tables needed by auth if not custom tables
auth.define_tables(username=True) # signature=False
auth.settings.create_user_groups=False
auth.settings.create_user_groups = False

## configure email
mail = auth.settings.mailer
Expand Down
2 changes: 1 addition & 1 deletion web2py/applications/smc/models/x_app_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# coding: utf8
# -*- coding: utf-8 -*-

import uuid

Expand Down
2 changes: 1 addition & 1 deletion web2py/applications/smc/models/x_fixtures.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# coding: utf8
# -*- coding: utf-8 -*-
import os
from ednet.ad import AD

Expand Down
2 changes: 2 additions & 0 deletions web2py/applications/smc/modules/ednet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

# Web2py settings
from gluon import *
from gluon import current
Expand Down
2 changes: 2 additions & 0 deletions web2py/applications/smc/modules/ednet/appsettings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

from gluon import *
from gluon import current

Expand Down
2 changes: 2 additions & 0 deletions web2py/applications/smc/modules/ednet/canvas.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

###### CanvasAPIClass
from gluon import *
from gluon import current
Expand Down
2 changes: 2 additions & 0 deletions web2py/applications/smc/modules/ednet/faculty.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

from gluon import *
from gluon import current

Expand Down
2 changes: 1 addition & 1 deletion web2py/applications/smc/modules/ednet/info.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__VERSION__ = "0.0.1"
# -*- coding: utf-8 -*-__VERSION__ = "0.0.1"
Expand Down
2 changes: 2 additions & 0 deletions web2py/applications/smc/modules/ednet/sequentialguid.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

###### SequentialGUID
import os
import datetime
Expand Down
2 changes: 2 additions & 0 deletions web2py/applications/smc/modules/ednet/student.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

from gluon import *
from gluon import current

Expand Down
2 changes: 2 additions & 0 deletions web2py/applications/smc/modules/ednet/util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

import re
import uuid
import threading
Expand Down
2 changes: 2 additions & 0 deletions web2py/applications/smc/modules/ednet/w2py.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

from gluon import *
from gluon import current

Expand Down
2 changes: 2 additions & 0 deletions web2py/applications/smc/modules/module_reload.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

import sys

MODULE_LIST = ["ednet.info",
Expand Down
2 changes: 1 addition & 1 deletion web2py/applications/smc/views/student/changepassword.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{extend 'layout.html'}}<h1>Change Your Password</h1>{{=form}}
{{extend 'layout.html'}}<h1>Change Your Password</h1>{{=form}}
Expand Down
8 changes: 7 additions & 1 deletion web2py/applications/smc/views/student/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
{{ extend 'layout.html' }}<h1>Student Resources</h1><ul><li><a href="{{=URL('student','changepassword')}}">Change Your Password</a></li></ul>
{{ extend 'layout.html' }}

<h1>Student Resources</h1>

<ul>
<li><a href="{{=URL('student','changepassword')}}">Change Your Password</a></li>
</ul>

0 comments on commit 6541fae

Please sign in to comment.