rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
return h_value("%s:%s:%s" % (username,realm,passwd)) def compute_response(urp_hash,nonce,cnonce,nonce_count,authzid,digest_uri):
return _h_value("%s:%s:%s" % (username,realm,passwd)) def _compute_response(urp_hash,nonce,cnonce,nonce_count,authzid,digest_uri):
def make_urp_hash(username,realm,passwd): """Compute MD5 sum of username:realm:password. :Parameters: - `username`: a username. - `realm`: a realm. - `password`: a password. :Types: - `username`: `str` - `realm`: `str` - `password`: `str` :return: the MD5 sum of the parameters joined with ':'. :returntype: `str`""" i...
return b2a_hex(kd_value( b2a_hex(h_value(a1)),"%s:%s:%s:%s:%s" % (
return b2a_hex(_kd_value( b2a_hex(_h_value(a1)),"%s:%s:%s:%s:%s" % (
def compute_response(urp_hash,nonce,cnonce,nonce_count,authzid,digest_uri): """Compute DIGEST-MD5 response value. :Parameters: - `urp_hash`: MD5 sum of username:realm:password. - `nonce`: nonce value from a server challenge. - `cnonce`: cnonce value from the client response. - `nonce_count`: nonce count value. - `auth...
cnonce,"auth",b2a_hex(h_value(a2)) ) )) def compute_response_auth(urp_hash,nonce,cnonce,nonce_count,authzid,digest_uri):
cnonce,"auth",b2a_hex(_h_value(a2)) ) )) def _compute_response_auth(urp_hash,nonce,cnonce,nonce_count,authzid,digest_uri):
def compute_response(urp_hash,nonce,cnonce,nonce_count,authzid,digest_uri): """Compute DIGEST-MD5 response value. :Parameters: - `urp_hash`: MD5 sum of username:realm:password. - `nonce`: nonce value from a server challenge. - `cnonce`: cnonce value from the client response. - `nonce_count`: nonce count value. - `auth...
return b2a_hex(kd_value( b2a_hex(h_value(a1)),"%s:%s:%s:%s:%s" % (
return b2a_hex(_kd_value( b2a_hex(_h_value(a1)),"%s:%s:%s:%s:%s" % (
def compute_response_auth(urp_hash,nonce,cnonce,nonce_count,authzid,digest_uri): """Compute DIGEST-MD5 rspauth value. :Parameters: - `urp_hash`: MD5 sum of username:realm:password. - `nonce`: nonce value from a server challenge. - `cnonce`: cnonce value from the client response. - `nonce_count`: nonce count value. - `...
cnonce,"auth",b2a_hex(h_value(a2)) ) )) param_re=re.compile(r'^(?P<var>[^=]+)\=(?P<val>(\"(([^"\\]+)|(\\\")'
cnonce,"auth",b2a_hex(_h_value(a2)) ) )) _param_re=re.compile(r'^(?P<var>[^=]+)\=(?P<val>(\"(([^"\\]+)|(\\\")'
def compute_response_auth(urp_hash,nonce,cnonce,nonce_count,authzid,digest_uri): """Compute DIGEST-MD5 rspauth value. :Parameters: - `urp_hash`: MD5 sum of username:realm:password. - `nonce`: nonce value from a server challenge. - `cnonce`: cnonce value from the client response. - `nonce_count`: nonce count value. - `...
m=param_re.match(challenge)
m=_param_re.match(challenge)
def challenge(self,challenge): """Process a challenge and return the response. :Parameters: - `challenge`: the challenge from server. :Types: - `challenge`: `str` :return: the response or a failure indicator. :returntype: `sasl.Response` or `sasl.Failure`""" if not challenge: self.__logger.debug("Empty challenge") re...
realms.append(unquote(val))
realms.append(_unquote(val))
def challenge(self,challenge): """Process a challenge and return the response. :Parameters: - `challenge`: the challenge from server. :Types: - `challenge`: `str` :return: the response or a failure indicator. :returntype: `sasl.Response` or `sasl.Failure`""" if not challenge: self.__logger.debug("Empty challenge") re...
nonce=unquote(val)
nonce=_unquote(val)
def challenge(self,challenge): """Process a challenge and return the response. :Parameters: - `challenge`: the challenge from server. :Types: - `challenge`: `str` :return: the response or a failure indicator. :returntype: `sasl.Response` or `sasl.Failure`""" if not challenge: self.__logger.debug("Empty challenge") re...
qopl=unquote(val).split(",")
qopl=_unquote(val).split(",")
def challenge(self,challenge): """Process a challenge and return the response. :Parameters: - `challenge`: the challenge from server. :Types: - `challenge`: `str` :return: the response or a failure indicator. :returntype: `sasl.Response` or `sasl.Failure`""" if not challenge: self.__logger.debug("Empty challenge") re...
if realm: realm=quote(realm)
if isinstance(realm,Failure): return realm elif realm: realm=_quote(realm)
def _make_response(self,charset,realms,nonce): """Make a response for the first challenge from the server.
username=quote(username)
username=_quote(username)
def _make_response(self,charset,realms,nonce): """Make a response for the first challenge from the server.
cnonce=quote(cnonce)
cnonce=_quote(cnonce)
def _make_response(self,charset,realms,nonce): """Make a response for the first challenge from the server.
params.append('nonce="%s"' % (quote(nonce),))
params.append('nonce="%s"' % (_quote(nonce),))
def _make_response(self,charset,realms,nonce): """Make a response for the first challenge from the server.
digest_uri=quote(digest_uri)
digest_uri=_quote(digest_uri)
def _make_response(self,charset,realms,nonce): """Make a response for the first challenge from the server.
authzid=quote(authzid)
authzid=_quote(authzid)
def _make_response(self,charset,realms,nonce): """Make a response for the first challenge from the server.
urp_hash=make_urp_hash(username,realm,self.password) response=compute_response(urp_hash,nonce,cnonce,nonce_count,
urp_hash=_make_urp_hash(username,realm,self.password) response=_compute_response(urp_hash,nonce,cnonce,nonce_count,
def _make_response(self,charset,realms,nonce): """Make a response for the first challenge from the server.
self.response_auth=compute_response_auth(urp_hash,nonce,cnonce,
self.response_auth=_compute_response_auth(urp_hash,nonce,cnonce,
def _make_response(self,charset,realms,nonce): """Make a response for the first challenge from the server.
:return: the realm chosen. :returntype: `str`"""
:return: the realm chosen or a failure indicator. :returntype: `str` or `Failure`"""
def _get_realm(self,realms,charset): """Choose a realm from the list specified by the server.
m=param_re.match(challenge)
m=_param_re.match(challenge)
def _final_challenge(self,challenge): """Process the second challenge from the server and return the response. :Parameters: - `challenge`: the challenge from server. :Types: - `challenge`: `str` :return: the response or a failure indicator. :returntype: `sasl.Response` or `sasl.Failure`""" if self.rspauth_checked: re...
self.realm=quote(realms[0])
self.realm=_quote(realms[0])
def start(self,response): """Start the authentication process. :Parameters: - `response`: the initial response from the client (empty for DIGEST-MD5). :Types: - `response`: `str` :return: a challenge, a success indicator or a failure indicator. :returntype: `sasl.Challenge`, `sasl.Success` or `sasl.Failure`""" self.l...
r=quote(r)
r=_quote(r)
def start(self,response): """Start the authentication process. :Parameters: - `response`: the initial response from the client (empty for DIGEST-MD5). :Types: - `response`: `str` :return: a challenge, a success indicator or a failure indicator. :returntype: `sasl.Challenge`, `sasl.Success` or `sasl.Failure`""" self.l...
nonce=quote(self.password_manager.generate_nonce())
nonce=_quote(self.password_manager.generate_nonce())
def start(self,response): """Start the authentication process. :Parameters: - `response`: the initial response from the client (empty for DIGEST-MD5). :Types: - `response`: `str` :return: a challenge, a success indicator or a failure indicator. :returntype: `sasl.Challenge`, `sasl.Success` or `sasl.Failure`""" self.l...
realm=quote(realm)
realm=_quote(realm)
def _parse_response(self,response): """Parse a client reponse and pass to further processing. :Parameters: - `response`: the response from the client. :Types: - `response`: `str` :return: a challenge, a success indicator or a failure indicator. :returntype: `sasl.Challenge`, `sasl.Success` or `sasl.Failure`""" respon...
m=param_re.match(response)
m=_param_re.match(response)
def _parse_response(self,response): """Parse a client reponse and pass to further processing. :Parameters: - `response`: the response from the client. :Types: - `response`: `str` :return: a challenge, a success indicator or a failure indicator. :returntype: `sasl.Challenge`, `sasl.Success` or `sasl.Failure`""" respon...
urp_hash=make_urp_hash(username,realm,password)
urp_hash=_make_urp_hash(username,realm,password)
def _make_final_challenge(self,username,realm,cnonce,digest_uri, response_val,authzid,nonce_count): """Send the second challenge in reply to the client response. :Parameters: - `username`: user name. - `realm`: realm. - `cnonce`: cnonce value. - `digest_uri`: digest-uri value. - `response_val`: response value computed...
valid_response=compute_response(urp_hash,self.nonce,cnonce,
valid_response=_compute_response(urp_hash,self.nonce,cnonce,
def _make_final_challenge(self,username,realm,cnonce,digest_uri, response_val,authzid,nonce_count): """Send the second challenge in reply to the client response. :Parameters: - `username`: user name. - `realm`: realm. - `cnonce`: cnonce value. - `digest_uri`: digest-uri value. - `response_val`: response value computed...
rspauth=compute_response_auth(urp_hash,self.nonce,
rspauth=_compute_response_auth(urp_hash,self.nonce,
def _make_final_challenge(self,username,realm,cnonce,digest_uri, response_val,authzid,nonce_count): """Send the second challenge in reply to the client response. :Parameters: - `username`: user name. - `realm`: realm. - `cnonce`: cnonce value. - `digest_uri`: digest-uri value. - `response_val`: response value computed...
expr='d:feature[@jid="%s"%s]' % (jid,node_expr)
expr='d:item[@jid="%s"%s]' % (jid,node_expr)
def has_item(self,jid,node=None): """Check if `self` contains an item.
expr="d:feature[@jid='%s'%s]" % (jid,node_expr)
expr="d:item[@jid='%s'%s]" % (jid,node_expr)
def has_item(self,jid,node=None): """Check if `self` contains an item.
return self.setitem(key,value)
return self.set_item(key,value)
def __setitem__(self,key,value): return self.setitem(key,value)
callback(k,self[k])
callback(key,self[key])
def _expire_item(self,key): """Do the expiration of a dictionary item. Remove the item if it has expired by now. :Parameters: - `key`: key to the object. :Types: - `key`: any hashable value""" (timeout,callback)=self._timeouts[key] if timeout<=time.time(): if callback: try: callback(k,self[k]) except TypeError: try: ...
callback(k)
callback(key)
def _expire_item(self,key): """Do the expiration of a dictionary item. Remove the item if it has expired by now. :Parameters: - `key`: key to the object. :Types: - `key`: any hashable value""" (timeout,callback)=self._timeouts[key] if timeout<=time.time(): if callback: try: callback(k,self[k]) except TypeError: try: ...
del self[k]
del self[key]
def _expire_item(self,key): """Do the expiration of a dictionary item. Remove the item if it has expired by now. :Parameters: - `key`: key to the object. :Types: - `key`: any hashable value""" (timeout,callback)=self._timeouts[key] if timeout<=time.time(): if callback: try: callback(k,self[k]) except TypeError: try: ...
expr=' and @node="%s"' % (node,)
node_expr=' and @node="%s"' % (node,)
def has_item(self,jid,node=None): """Check if `self` contains an item.
expr=" and @node='%s'" % (node,)
node_expr=" and @node='%s'" % (node,)
def has_item(self,jid,node=None): """Check if `self` contains an item.
self.debug("data on input")
def _loop_iter(self,timeout): import select self.lock.release() try: id,od,ed=select.select([self.socket],[],[self.socket],timeout) finally: self.lock.acquire() if self.socket in id or self.socket in ed: self.debug("data on input") self._process() return 1 else: self.debug("input timeout") self._idle() return 0
self.debug("input timeout")
def _loop_iter(self,timeout): import select self.lock.release() try: id,od,ed=select.select([self.socket],[],[self.socket],timeout) finally: self.lock.acquire() if self.socket in id or self.socket in ed: self.debug("data on input") self._process() return 1 else: self.debug("input timeout") self._idle() return 0
self.xmlnode=common_doc.newChild(None,name_or_xmlnode,None)
self.xmlnode=common_doc.newChild(common_ns,name_or_xmlnode,None)
def __init__(self, name_or_xmlnode, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None): """Initialize a Stanza object.
for element in xml_element_iter(xmlnode.children):
for element in xml_element_iter(self.xmlnode.children):
def set_history(self, parameters): for element in xml_element_iter(xmlnode.children): if get_node_ns_uri(child) == MUC_NS and element.name == "history": element.unlinkNode() element.freeNode() break if parameters.maxchars and parameters.maxchars < 0: raise ValueError, "History parameter maxchars must be positive" if p...
if (history_maxchars or history_maxstanzas or history_seconds or history_since): history = HistoryParams(history_maxchars, history_maxstanzas,
if (history_maxchars is not None or history_maxstanzas is not None or history_seconds is not None or history_since is not None): history = HistoryParameters(history_maxchars, history_maxstanzas,
def make_join_request(self, password = None, history_maxchars = None, history_maxstanzas = None, history_seconds = None, history_since = None): """ Make the presence stanza a MUC room join request.
and are_domains_equal(self.domain)
and are_domains_equal(self.domain,other.domain)
def __eq__(self,other): if other is None: return 0 elif type(other) in (StringType,UnicodeType): try: other=JID(other) except: return 0 elif not isinstance(other,JID): raise TypeError,"Can't compare JID with %r" % (type(other),) return (self.node==other.node and are_domains_equal(self.domain) and self.resource==other....
def xml(self,parent):
def as_xml(self,parent):
def xml(self,parent): """Create vcard-tmp XML representation of the field.
def xml(self,doc=None,parent=None):
def as_xml(self,doc=None,parent=None):
def xml(self,doc=None,parent=None): """Get the XML representation of `self`.
New document will be created if not `parent` and no `doc` is given.
New document will be created if no `parent` and no `doc` is given.
def xml(self,doc=None,parent=None): """Get the XML representation of `self`.
doc=libxml2.newDoc("1.0") root=doc.newChild(None,"vCard",None)
if doc: doc1=doc else: doc1=libxml2.newDoc("1.0") root=doc1.newChild(None,"vCard",None) if not doc: doc1.setRootElement(root)
def xml(self,doc=None,parent=None): """Get the XML representation of `self`.
v.xml(root)
v.as_xml(root)
def xml(self,doc=None,parent=None): """Get the XML representation of `self`.
value.xml(root) if parent:
value.as_xml(root) if doc:
def xml(self,doc=None,parent=None): """Get the XML representation of `self`.
for element in xml_element_iter(self.xmlnode.children): if get_node_ns_uri(child) == MUC_NS and element.name == "history": element.unlinkNode() element.freeNode()
for child in xml_element_iter(self.xmlnode.children): if get_node_ns_uri(child) == MUC_NS and child.name == "history": child.unlinkNode() child.freeNode()
def set_history(self, parameters): for element in xml_element_iter(self.xmlnode.children): if get_node_ns_uri(child) == MUC_NS and element.name == "history": element.unlinkNode() element.freeNode() break if parameters.maxchars and parameters.maxchars < 0: raise ValueError, "History parameter maxchars must be positive"...
for element in xml_element_iter(xmlnode.children): if get_node_ns_uri(child) == MUC_NS and element.name == "history":
for child in xml_element_iter(self.xmlnode.children): if get_node_ns_uri(child) == MUC_NS and child.name == "history":
def get_history(self): for element in xml_element_iter(xmlnode.children): if get_node_ns_uri(child) == MUC_NS and element.name == "history": maxchars = from_utf8(child.prop("maxchars")) if maxchars is not None: maxchars = int(maxchars) maxstanzas = from_utf8(child.prop("maxstanzas")) if maxstanzas is not None: maxstanz...
for element in xml_element_iter(xmlnode.children): if get_node_ns_uri(child) == MUC_NS and element.name == "password": element.unlinkNode() element.freeNode()
for child in xml_element_iter(self.xmlnode.children): if get_node_ns_uri(child) == MUC_NS and child.name == "password": child.unlinkNode() child.freeNode()
def set_password(self, password): for element in xml_element_iter(xmlnode.children): if get_node_ns_uri(child) == MUC_NS and element.name == "password": element.unlinkNode() element.freeNode() break if password is not None: self.xmlnode.newTextChild(self.xmlnode.ns(), "password", to_utf8(password))
for element in xml_element_iter(xmlnode.children): if get_node_ns_uri(child) == MUC_NS and element.name == "password":
for child in xml_element_iter(self.xmlnode.children): if get_node_ns_uri(child) == MUC_NS and child.name == "password":
def get_password(self): for element in xml_element_iter(xmlnode.children): if get_node_ns_uri(child) == MUC_NS and element.name == "password": return from_utf8(child.getContent()) return None
self.handler.configuration_form_received(self, form)
self.handler.configuration_form_received(form)
def process_configuration_form_success(self, stanza): """ Process successful result of a room configuration form request.
:Parameters: - `form`: the configuration parameters. Should be a `submit` form made by filling-in the configuration form retireved using `self.request_configuration_form`.
Do nothing if the provided form is of type 'cancel'. :Parameters: - `form`: the configuration parameters. Should be a 'submit' form made by filling-in the configuration form retireved using `self.request_configuration_form` or a 'cancel' form.
def configure_room(self, form): """ Configure the room using the provided data.
:return: id of the request stanza.
:return: id of the request stanza or `None` if a 'cancel' form was provieded.
def configure_room(self, form): """ Configure the room using the provided data.
if form.type!="submit":
if form.type == "submit": return None elif form.type != "submit":
def configure_room(self, form): """ Configure the room using the provided data.
self.add_identity(identity.item_name,identity.item_category,identity.item_type)
self.add_identity(identity.name,identity.category,identity.type)
def set_identities(self,identities): """Set identities in the disco#info object.
self.xmlnode.setProp("name",to_utf8(xmlnode_or_name))
if xmlnode_or_name: self.xmlnode.setProp("name",to_utf8(xmlnode_or_name))
def __init__(self, disco, xmlnode_or_name, item_category=None, item_type=None, replace=False): """Initialize an `DiscoIdentity` object.
if not jid: raise ValueError,"bad jid" if isinstance(jid,JID): jid=jid.as_string() if not node: node_expr="" elif '"' not in node: node_expr=' and @node="%s"' % (node,) elif "'" not in node: node_expr=" and @node='%s'" % (node,) else: raise ValueError,"Invalid node name" if '"' not in jid: expr='d:item[@jid="%s"%s]' % ...
l=self.xpath_ctxt.xpathEval("d:item") if l is None:
def has_item(self,jid,node=None): """Check if `self` contains an item.
return self.form.type
return self.form
def get_form(self, form_type = "form"): """Return Data Form for the `Register` object.
- `name`: organization name. - `unit`: organizational unit. :Types: - `name`: `unicode` - `unit`: `unicode`
- `keywords`: category keywords. :Types: - `keywords`: `list` of `unicode`
def xml(self,parent): """Create vcard-tmp XML representation of the field.
psplit=label.split(";")
psplit=label.lower().split(";")
def _process_rfc2425_record(self,data): """Parse single RFC2425 record and update attributes of `self`.
return self.content[name.upper()]
return self.content[name.upper().replace("_","-")]
def __getattr__(self,name): try: return self.content[name.upper()] except KeyError: raise AttributeError,"Attribute %r not found" % (name,)
XMPP = Client(CONFIG['jid'].getDomain())
XMPP = Client(CONFIG['jid'].getDomain(), debug=[])
def messageHandler(conn, mess_node): """Message handler""" body = mess_node.getBody() sbody = body.split(" ") reply = None tipo = mess_node.getType() jid = JID(mess_node.getFrom()).getStripped() res = JID(mess_node.getFrom()).getResource() if body: """ if jid in CONFIG['admins']: if body.lower() == "quit": crawler.sto...
oku = self.data[jid].unsubs_feed(tempfeed) okf = self.feeds[feed].del_user(tempuser)
if tempuser: oku = self.data[jid].unsubs_feed(tempfeed) else: oku = False if tempfeed: okf = self.feeds[feed].del_user(tempuser) else: okf = False
def del_feed(self, jid, feed): """Delete an user subscription."""
if entry.get('title'): temp = repr(entry['title']) if entry.get('link'): temp += repr(entry.link) if entry.get('summary'): temp += repr(entry.summary)
def checkFeed(self, feedUrl): """Retrieve and parse a feed""" #try: txt = None feed = feeds[feedUrl] fp = feedparser.parse(feedUrl)
temphash = sha.new(repr(entry)).hexdigest()
temphash = sha.new(temp).hexdigest()
def checkFeed(self, feedUrl): """Retrieve and parse a feed""" #try: txt = None feed = feeds[feedUrl] fp = feedparser.parse(feedUrl)
temp = feed.items_pending[0]
temp = feed.last_items[0]
def checkFeed(self, feedUrl): """Retrieve and parse a feed""" #try: txt = None feed = feeds[feedUrl] fp = feedparser.parse(feedUrl)
userNotifications(userjid, "*New* items for %s\n%s\n" % (feed.title, feed.url))
userNotifications(userjid, "*New* items for %s (%s)" % (feed.title, feed.url))
def feedNotifications(self, feedUrl): """Send all pending items of this feed""" feed = feeds[feedUrl] for userjid in feed.users: userNotifications(userjid, "*New* items for %s\n%s\n" % (feed.title, feed.url))
if not XMPP.getRoster().getShow(user.jid) == None and len(user.items_pending) > 0:
if len(XMPP.getRoster().getResources(user.jid)) > 0 and len(user.items_pending) > 0:
def userNotifications(userjid, initialtext = None): """Send notification to some JID""" user = users[userjid] # if the user is conected and have pending items... if not XMPP.getRoster().getShow(user.jid) == None and len(user.items_pending) > 0: if initialtext: XMPP.send(Message(to = user.jid, body = initialtext, typ = ...
text = "\n%s\n%s" % (re.replace('<.*?>', '', item.title), item.permalink) if item.text != "": text += "\n\n%s" % (re.replace('<.*?>', '', item.text))
text = "\n*%s*\n%s" % (re.sub('<.*?>', '', item.title), item.permalink) if item.text != "": text += "\n\n%s" % (re.sub('<.*?>', '', item.text))
def userNotifications(userjid, initialtext = None): """Send notification to some JID""" user = users[userjid] # if the user is conected and have pending items... if not XMPP.getRoster().getShow(user.jid) == None and len(user.items_pending) > 0: if initialtext: XMPP.send(Message(to = user.jid, body = initialtext, typ = ...
fp = feedparser.parse(_feed.url)
fp = feedparser.parse(self._feed.url)
def check(self): """Retrieve and parse a feed""" #try: txt = None fp = feedparser.parse(_feed.url)
if fp.feed.get('title'): _feed.title = fp.feed.title if fp.feed.get('link'): _feed.url = fp.feed.link
if fp.feed.get('title'): self._feed.title = fp.feed.title if fp.feed.get('link'): self._feed.url = fp.feed.link
def check(self): """Retrieve and parse a feed""" #try: txt = None fp = feedparser.parse(_feed.url)
if not temphash in _feed.last_items: _feed.last_items.append(temphash)
if not temphash in self._feed.last_items: self._feed.last_items.append(temphash)
def check(self): """Retrieve and parse a feed""" #try: txt = None fp = feedparser.parse(_feed.url)
for user in _feed.users:
for user in self._feed.users:
def check(self): """Retrieve and parse a feed""" #try: txt = None fp = feedparser.parse(_feed.url)
summary = ''
text = ''
def check(self): """Retrieve and parse a feed""" #try: txt = None fp = feedparser.parse(self._feed.url)
if entry.get('link'): title = entry.link if entry.get('summary'): title = entry.summary if entry.get('updated'): title = entry.updated
if entry.get('link'): link = entry.link if entry.get('summary'): text = entry.summary if entry.get('updated'): updated = entry.updated
def check(self): """Retrieve and parse a feed""" #try: txt = None fp = feedparser.parse(self._feed.url)
temphash = sha.new( repr(title) + repr(link) + repr(summary) ).hexdigest()
temphash = sha.new( repr(title) + repr(link) + repr(text) ).hexdigest()
def check(self): """Retrieve and parse a feed""" #try: txt = None fp = feedparser.parse(self._feed.url)
ci.text = summary
ci.text = text
def check(self): """Retrieve and parse a feed""" #try: txt = None fp = feedparser.parse(self._feed.url)
ci.dte = updated
ci.date = updated
def check(self): """Retrieve and parse a feed""" #try: txt = None fp = feedparser.parse(self._feed.url)
users[userjid].items_pending.pop(0)
user.items_pending.pop(0)
def check(self): """Retrieve and parse a feed""" #try: txt = None fp = feedparser.parse(self._feed.url)
while len(feed.last_items) > 50: feed.last_items.pop(pop)
while len(self._feed.last_items) > 50: self._feed.last_items.pop(pop)
def check(self): """Retrieve and parse a feed""" #try: txt = None fp = feedparser.parse(self._feed.url)
if len(f.v) == 3:
verts = len(f.v) if verts < 2: print (" *! Found a face with one or " + "less vertices. I'd call that patently " + "ridiculous.") if verts == 2: print (" *! Object has a face has 2 vertices." + " That's an odd one! It won't be added.") elif verts == 3:
def addFace(self, f): """Takes a NMFace and puts its information to Trimesh.""" # reminder: f is of type NMFace (NMesh Face). if len(f.v) == 3: self._addTriangleFace(f) elif len(f.v) == 4: self._addQuadFace(f) else: print "WARNING: Too many verts in face! Not added." print " You need to divide this face manually."
elif len(f.v) == 4:
elif verts == 4:
def addFace(self, f): """Takes a NMFace and puts its information to Trimesh.""" # reminder: f is of type NMFace (NMesh Face). if len(f.v) == 3: self._addTriangleFace(f) elif len(f.v) == 4: self._addQuadFace(f) else: print "WARNING: Too many verts in face! Not added." print " You need to divide this face manually."
print "WARNING: Too many verts in face! Not added." print " You need to divide this face manually."
print (" *! Can't add face with %d verts! " + "You need to divide this face manually.") % verts
def addFace(self, f): """Takes a NMFace and puts its information to Trimesh.""" # reminder: f is of type NMFace (NMesh Face). if len(f.v) == 3: self._addTriangleFace(f) elif len(f.v) == 4: self._addQuadFace(f) else: print "WARNING: Too many verts in face! Not added." print " You need to divide this face manually."
o+= ''.join(map(lambda f: " %d %d %d %d %d %d %d 1\n" % tuple(f),
o += join(map( lambda f: " %d %d %d %d %d %d %d 1\n" % tuple(f),
def _faces_as_string(self): o = (" faces %d\n" % len(self._faces)) o+= ''.join(map(lambda f: " %d %d %d %d %d %d %d 1\n" % tuple(f), self._faces)) return o
o+= str(tuple(map(lambda tv: " %f %f 0\n" % tuple(tv), self._texverts)))
o += join(map(lambda tv: " %f %f 0\n" % tuple(tv), self._texverts))
def _texverts_as_string(self): if self._texture: o = (" tverts %d\n" % len(self._texverts)) o+= str(tuple(map(lambda tv: " %f %f 0\n" % tuple(tv), self._texverts))) else: o = " tverts 1\n 0 0 0\n" return o
pwkmesh = processobject(pwkname, 'NULL', 0)
pwkmesh = processobject(pwkname, "NULL")
def processdownfrom(model): childs = scnobjchilds[model] print " ** %s children: %s" % (model, join(childs, ", ")) for mchild in childs: processobject(mchild,model)
buffer.apply_tag(self.tag, self._start_text_iter(), self.end_iter())
start_txt_iter = self._start_text_iter() start_txt_iter.backward_char() buffer.apply_tag(self.tag, start_txt_iter, self.end_iter())
def _reapply_tags(self): buffer = self.get_buffer() buffer.remove_all_tags(self.start_iter(), self.end_iter()) buffer.apply_tag_by_name('start_filepart', self.start_iter(), self._start_text_iter()) buffer.apply_tag(self.tag, self._start_text_iter(), self.end_iter()) buffer.apply_tag_by_name('end_filepart', self._end_te...
contactsimages = getattr(self, 'contactsimages', None)
def get_image(self): """ Get the URL of the user's image.
for id in ['%s.jpg' % self.getId(), '%s.jpg' % self.getId()]: image = getattr(self.contactsimages, id, None) if image: imageurl = image.absolute_url(1) break
def get_image(self): """ Get the URL of the user's image.
'%s_%s_%s.jpg' % (self.lastName, self.firstName, self.getId()), '%s_%s_%s.jpg' % (self.lastName, self.preferredName, self.getId())]:
'%s_%s_%s.jpg' % (self.lastName.lower(), self.firstName.lower(), self.getId()), '%s_%s_%s.jpg' % (self.lastName.lower(), self.preferredName.lower(), self.getId())]:
def get_image(self): """ Get the URL of the user's image.
possible_list_id = possible_list_match[0]
possible_list_id = possible_list_match.groups()[0]
def add_groupWithNotification(self, group): """ Add a group to the user, and if available, send them a notification. """ import re acl_users = getattr(self, 'acl_users', None) site_root = self.site_root()
try: moderated_members = groupList.getValueFor('moderated_member$ if self.getId() not in moderated_members:
if groupList.hasProperty('moderated_members'): moderated_members = list(groupList.getProperty('moderated_members', [])) if self.getId() not in moderated_members:
def add_groupWithNotification(self, group): """ Add a group to the user, and if available, send them a notification. """ import re acl_users = getattr(self, 'acl_users', None) site_root = self.site_root()
groupList.setValueFor('moderated_members', moderated_members) except:
groupList.manage_changeProperties(moderated_members=moderated_members) else: moderated_members = [self.getId()]
def add_groupWithNotification(self, group): """ Add a group to the user, and if available, send them a notification. """ import re acl_users = getattr(self, 'acl_users', None) site_root = self.site_root()
self.manage_delProperties([property])
try: self.manage_delProperties([property]) except: pass
def remove_deliveryEmailAddressByKey(self, key, email): """ Remove an email address as a modified delivery option for a specific group. """ email = self._validateAndNormalizeEmail(email) property = '%s_emailAddresses' % key email_addresses = list(self.getProperty(property, [])) if email in email_addresses: email_addr...
' (%s). Valid characters are %s.' % validChars)
' (%s). Valid characters are %s.' % (user_id, char, validChars))
def register_user(self, email, user_id='', first_name='', last_name='', password_length=8, roles=[], groups=[], post_groups=[]): """ A method for a user to allow a user to register themselves. """ import string, DateTime validChars = string.letters+string.digits+'.' # unverified members always get this placeholder g...
CustomUser.addCustomUser(user_folder, name, password, roles, domains)
CustomUser.addCustomUser(user_folder, name, password, roles, domains, groups)
def _doAddUser(self, name, password, roles, domains, groups=(), **kw): """ Create a new user. """ import CustomUser user_folder = self._getUserFolder() if password is not None and self.encrypt_passwords: password = self._encryptPassword(password) CustomUser.addCustomUser(user_folder, name, password, roles, domains) ...
security.declareProtected(Perms.manage_properties, 'get_deliverSettingsByKey')
security.declareProtected(Perms.manage_properties, 'get_deliverySettingsByKey')
def set_disableDigestByKey(self, key): """ Disable the email digest for a given key. The key normally represents a group, but may represent something else in the future. """ digest_property = '%s_digest' % key # we don't create the property if it doesn't exist if self.hasProperty(digest_property): self.manage_changeP...
user_id=user_id,
user_id=self.getId(),
def send_userVerification(self): """ Send the user a verification email. """ presentation = self.Templates.email try: mailhost = self.superValues('Mail Host')[0] except: raise AttributeError, "Can't find a Mail Host object" email_addresses = self.get_emailAddresses() email_strings = [] for email_address in email_add...
new_id += char
newid += char
def get_image(self): """ Get the URL of the user's image.