Ejemplo n.º 1
0
def create_dudlr(user, name):
    """
    Create a new dudlr user
    """
    dudlr = Dudlr()
    dudlr.name = name
    dudlr.user = user
    dudlr.put()
Ejemplo n.º 2
0
def set_dudlr_name(user, name):
    """
    Update Dudlr with new nickname.  Note that this can only be
    changed once.

    @param user: C{User} object
    @param name: new name for user
    """
    dudlr = Dudlr.all().filter('user = '******'name = ', name).get()
    if other:
        raise DudleException(ERROR_DUDLR_NAME_TAKEN)
    dudlr.name = name
    dudlr.put()
Ejemplo n.º 3
0
def get_dudlr(user=None):
    """
    Get the dudlr associated with google user.

    @param user: C{User} object
    """
    user = user or users.get_current_user()
    if not user:
        return
    dudlr = Dudlr.all()
    dudlr.filter('user = ', user)
    dudlr = dudlr.get()
    if not dudlr:
        dudlr = Dudlr(user=user, name=user.nickname())
        dudlr.put()
    return dudlr
Ejemplo n.º 4
0
def get_dudlr_by_name(name):
    """
    Get dudlr by name.

    @param name: nickname of dudlr
    """
    dudlr = Dudlr.all().filter('name = ', name).get()
    return dudlr
Ejemplo n.º 5
0
def get_dudlr_by_id(id):
    """
    Get dudlr by id.

    @param id: numeric id of the C{Dudlr}
    """
    key = Key.from_path('Dudlr', id)
    dudlr = Dudlr.get(key)#Dudlr.all().filter('name = ', name).get()
    return dudlr