Commits

Konstantine Rybnikov  committed 4b8b57d Merge

merge pull request #6

  • Participants
  • Parent commits 58e3e97, 0da665e

Comments (0)

Files changed (3)

 
 Join me on jabber conference xmppflask@conference.jabber.org
 
-I am working on homepage at http://xmppflask.org .
+I am working on homepage at `http://xmppflask.org`_.
 
 ------
 Status
 ------
 
-Right now I am working on 0.1 release.
+It's in status of ideal suitability for "use and help polishing it",
+since some obvious improvements could be done.
 
 -------
 Authors
 -------
 
-Main (and right now is the only) author is Kostya Rybnikov
-(`homepage in russian <http://redhotchilipython.com>`_).
+Original author is `Konstantine Rybnikov
+<http://redhotchilipython.com>`_. Current main developer is `Alexander
+Shorin <https://bitbucket.org/kxepal>`_
 
-You could be the next one.
+Great thanks to contributors:
+
+* `Brendan McCollam <https://bitbucket.org/bjmc>`_
+
+Feel free to be the next one.
 
 -----------------
 Where to go next?
 -----------------
 
-Go to the introduction page!
+Go to the `docs <http://xmppflask.readthedocs.org>`_.

File examples/pirate_weather/pirate_weather.py

     'Amsterdam': u"+23 sunny. ARRRGH!!",
 }
 
+
 def get_weather_for_city(city):
-	return (
+    return (
         weather_dict.get(
             city,
             u"Weather for %(city)s unknown. ARHG!!" % dict(city=city)))
 
+
 def get_weather_cities():
     return weather_dict.keys()
 
+
 @app.route('ping')
 def ping():
     return 'pong'
 
+
 @app.route('help')
 def help():
     return (u'Type "weather in <city_name>" to get weather in that city.\n'
             u'Type "cities" to get list of cities.')
 
+
 @app.route('cities')
 def cities():
     return u', '.join(get_weather_cities())
 
+
 @app.route('weather in <city>')
 def weather(city):
-	return get_weather_for_city(city)
+    return get_weather_for_city(city)

File xmppflask/routing.py

         self.type = type
         self.greediness = 0
         self.redirect_to = redirect_to
-        
+
         self._trace = None
         self._weights = None
         self._converters = None
         self._regex = None
-        
+
         if defaults is not None:
             self.arguments = set(map(str, defaults))
         else:
             if self.defaults is not None:
                 result.update(self.defaults)
             return result
-    
+
     def build(self, values):
         """
         :internal:
                     return False
 
         return True
-    
+
     def __repr__(self):
         if self.map is None:
             return u'<%s (unbound)>' % self.__class__.__name__
             u''.join(tmp),
             self.endpoint
         )
-    
+
     def match_compare(self, other):
         """Compare this object with another one for matching.
-        Needed to match "hello world" rule before "hello" rule ("hello" 
+        Needed to match "hello world" rule before "hello" rule ("hello"
         must be later in search/match order).
 
         :internal:
 
 class Map(object):
     """Map of routes and their handlers"""
-    
+
     #: for more on converters see http://werkzeug.pocoo.org/docs/routing/
     default_converters = ImmutableDict(DEFAULT_CONVERTERS)
-    
+
     def __init__(self, rules=None, converters=None):
         self._rules = []
         self._rules_by_endpoint = {}
         self._remap = True
-        
+
         self.converters = self.default_converters.copy()
         if converters:
             self.converters.update(converters)
         for rulefactory in rules or ():
             self.add(rulefactory)
-    
+
     def add(self, rulefactory):
         """Add a new rule to the map and bind it.
-        
+
         :param rule: a :class:`Rule`
         """
         for rule in rulefactory.get_rules(self):
                          from_jid=environ.get('XMPP_JID'),
                          message=environ.get('MESSAGE', ''),
                          type=environ.get('type'))
-    
+
     def update(self):
         if self._remap:
             self._rules.sort(lambda a, b: a.match_compare(b))
             for rules in self._rules_by_endpoint.itervalues():
-                rules.sort(lambda a, b: a.build_compare(b))
+                rules.sort(lambda a, b: a.match_compare(b))
             self._remap = False
 
 class MapAdapter(object):
         self.from_jid = from_jid
         self.type = type
         self.map = map_
-    
+
     def match(self, message=None, return_rule=False,
               event_type=None, from_jid=None, type=None):
         """The actual match func that is used to get endpoint (or rule) and
             else:
                 return rule.endpoint, rv
         raise NotFound()
-    
+
     def build(self, endpoint, values=None):
         """Building messages that suite certain endpoint with valutes (params).
 
-        In XMPP world it might be not as must-have feature, but still it's 
+        In XMPP world it might be not as must-have feature, but still it's
         needed and nice.
         """
         self.map.update()
                               if v is not None)
         else:
             values = {}
-        
+
         rv = self._partial_build(endpoint, values)
         if rv is None:
             raise BuildError(endpoint, values)