instead of blanks.
Signed-off-by: Art Rhyno <art632000@yahoo.ca>
authtoken, patron,
["first_given_name","family_name","email","usrname"])
patron_info = req.send()
- display = ('%s %s, '
- '<%s>. [%s]') % (patron_info.first_given_name(),
- patron_info.family_name(),
- patron_info.email(), patron_info.usrname())
- out.append((patron_info.usrname(), display))
+ if patron_info.usrname():
+ first_name = ""
+ family_name = ""
+ email = ""
+ if patron_info.first_given_name():
+ first_name = patron_info.first_given_name()
+ if patron_info.family_name():
+ family_name = patron_info.family_name()
+ if patron_info.email():
+ email = patron_info.email()
+ display = ('%s %s, '
+ '<%s>. [%s]') % (first_name,
+ family_name,
+ email, patron_info.usrname())
+ out.append((patron_info.usrname(), display))
#clean up session
session_cleanup(authtoken)
if dir_entry is None:
return
- self.first_name = dir_entry['given_name']
- self.last_name = dir_entry['surname']
- self.email = dir_entry.get('email', self.email)
+ first_name = ""
+ last_name = ""
+ email = ""
+
+ if dir_entry['given_name']:
+ first_name = dir_entry['given_name']
+ if dir_entry['surname']:
+ last_name = dir_entry['surname']
+ if dir_entry.get('email', self.email):
+ email = dir_entry.get('email', self.email)
+
+ self.first_name = first_name
+ self.last_name = last_name
+ self.email = email
self.save()
if 'patron_id' in dir_entry:
return g.render('admin/staff_add.xhtml', **locals())
else:
userid = request.POST.get('userid','').strip()
- print "userid", userid
message_continue = True
try:
user = User.objects.get(username=userid)
except User.DoesNotExist:
- print "about to create"
user = User.objects.create(username=userid)
- print "created", user
- print "1"
user.maybe_decorate()
- print "2"
user.is_staff = True
user.is_superuser = True # TODO: are we sure they should be superuser?
# then the owner may be a username instead of an ID, and
# the user may not exist in the local database.
userid = POST.get('owner', '').strip()
- if userid and not userid.isdigit():
+ is_barcode = re.search('\d{14}', userid)
+ if userid and (not userid.isdigit() or is_barcode):
try:
user = User.objects.get(username=userid)
except User.DoesNotExist:
style="display: ${'none' if owner else 'block'}">
<div style="font-size: 80%; margin: 0.5em 0;">Type a partial name or userid into the box; then select one of the matches.</div>
<input type="text" id="fuzzyinput" autocomplete="off" value="${owner.username if owner else ''}"/>
+ <span style="margin: 8px;">
+ <select id="search_level">
+ <option value="EVERYONE" selected="selected">Everyone</option>
+ <option value="STAFF">Staff</option>
+ <option value="USERNAME">Username</option>
+ </select>
+ </span>
<div id="fuzzypanel">
</div>
</div>