def bot_post(self, mess, args): 'Envia un comentario a sweetter. Uso:\n\tpost <comentario>\n' f = mess.getFrom() user = f.getNode()+'@'+f.getDomain() try: suser = plugin.juser.get_filter(user)[0] request = Request_moc(suser.user) new_post(suser.user, args, request) except: return "fallo :("
def new(request): text = request.POST['text'] uapi.new_post(request.user, text, request) return HttpResponseRedirect(request.META['HTTP_REFERER'])
#!/usr/bin/python # -*- coding: utf-8 -*- import random from ublogging.models import User from ublogging.uapi import new_post, Request_moc posts = ( "probando sweetter 3.0", "escribo un post con referencia @pepe", "un post con enlaces http://sweetter.net, http://danigm.net", "un post con varios replies @pepe, @juan, @nota", "un post con tíldes y ñ", "arrrrrrrrrrrrrrrrrrrrrrrg", ) u = User.objects.get(username='******') p = random.choice(posts) new_post(u, p, Request_moc(u))
#!/usr/bin/python # -*- coding: utf-8 -*- from ublogging.register import adduser from ublogging.uapi import new_post, Request_moc users = ( ("pepe", "123", "*****@*****.**"), ("juan", "123", "*****@*****.**"), ("jose", "123", "*****@*****.**"), ("nota", "123", "*****@*****.**"), ("cabeza", "123", "*****@*****.**"), ("culebra", "123", "*****@*****.**"), ) posts = ( "probando sweetter 3.0", "escribo un post con referencia @pepe", "un post con enlaces http://sweetter.net, http://danigm.net", "un post con varios replies @pepe, @juan, @nota", "un post con tíldes y ñ", "arrrrrrrrrrrrrrrrrrrrrrrg", ) for i in users: u = adduser(*i) for p in posts: new_post(u, p, Request_moc(u))
def update(request): user = request.user status = request.POST['status'] post = uapi.new_post(user, status) return HttpResponse(json.dumps(jsonize_post(post)), mimetype='application/json')