Example #1
0
    def test_delete_alias(self):
        create_employee(username='******')
        alias = logic.alias.save_alias('jane', 'janed')
        self.assertEqual(Alias.query().count(), 1)

        logic.alias.delete_alias(alias.key.id())

        self.assertEqual(Alias.query().count(), 0)
Example #2
0
    def test_save_alias(self):
        johnd = create_employee(username='******')
        self.assertEqual(Alias.query().count(), 0)

        alias = logic.alias.save_alias('johnny', 'johnd')

        self.assertEqual(Alias.query().count(), 1)
        self.assertEqual(alias.name, 'johnny')
        self.assertEqual(alias.owner_key, johnd.key)
Example #3
0
def name_for_alias(alias_name):
    alias = Alias.query(Alias.name == alias_name).get()
    if alias:
        employee = alias.owner_key.get()
        if employee:
            return employee.username
    else:
        return alias_name
Example #4
0
 def get(self):
     upload_url = blobstore.create_upload_url('/upload')
     
     templates, aliases = Template.query().order(Template.key).fetch(), Alias.query().order(Template.key).fetch()
     #templates.extend(aliases)
     templates = [ t.key.string_id() for t in templates ]
     templates.sort()
     
     template = JINJA_ENVIRONMENT.get_template('form.html')
     self.response.write(template.render({'upload_url': upload_url,
                                          'templates': templates}))
Example #5
0
File: web.py Project: sharan1/love
def aliases():
    return render_template(
        'aliases.html',
        aliases=Alias.query().fetch(),
    )
Example #6
0
def get_alias(alias):
    return Alias.query(Alias.name == alias).get()