예제 #1
0
파일: database.py 프로젝트: wildone/pycopia
def get_user(conf):
    sess = conf.session
    pwent = passwd.getpwuid(os.getuid())
    try:
#        user = models.User.objects.get(username=pwent.name)
        user = sess.query(models.User).filter(models.User.username==pwent.name).one()
    except NoResultFound:
        user = models.create_user(sess, pwent)
    return user
예제 #2
0
 def get_pwent(self, name=None, uid=None):
     if uid is not None:
         return passwd.getpwuid(int(uid))
     return passwd.getpwnam(name)
예제 #3
0
 def get_pwent(self, name=None, uid=None):
     if uid is not None:
         return passwd.getpwuid(int(uid))
     return passwd.getpwnam(name)