def main(self): yield self.initComponents() while 1: if self.dataReady("control"): mes = self.recv("control") if isinstance(mes, shutdownMicroprocess) or \ isinstance(mes, producerFinished): self.send(producerFinished(), "signal") break if self.dataReady("inbox"): feed = self.recv('inbox') for entry in feed.entries: for link in entry.links: if link.rel == 'edit-media' and link.type == 'application/xml': profile_name = urlparse(link.href)[2].rsplit('/', -1)[-1] pwd = ProfileManager.get_profile_password(self.base_dir, profile_name) profile = ProfileManager.load_profile(self.base_dir, self.atompub, profile_name) if not Client.get_status(profile_name): Client.connect_jabber_user(self.atompub, profile_name.lower(), pwd, profile) continue if not self.anyReady(): self.pause() yield 1
def signup_complete(self, username): username = username.strip() valid = True if not username: valid = False if ProfileManager.has_profile(self.atompub, username): valid = False if not valid: tpl = self.tpl_lookup.get_template('newaccount_step2.mako') return tpl.render(username=username, error="Username already taken") profile = UserProfile(username) profile.fill(nickname=username) ProfileManager.store_profile(self.atompub, profile) cherrypy.session[MICROBLOG_SESSION_PROFILE] = profile if cherrypy.request.openid: oid = cherrypy.request.openid.info.identity_url cherrypy.session[oid] = profile w = self.atompub.add_workspace(profile.username) c = self.atompub.add_collection(w, profile.username) self.atompub.save_service() self.attach_serving_collection_application(c, profile, d = cherrypy.request.dispatch) self.new_profiles_atompub_app.add_profile(profile) self.profiles_atompub_app.add_profile(profile) raise cherrypy.HTTPRedirect('/%s' % profile.username)