Django

Code

Changeset 2344

Show
Ignore:
Timestamp:
02/18/06 14:56:18 (3 years ago)
Author:
adrian
Message:

magic-removal: Merged to [2343]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/AUTHORS

    r2329 r2344  
    6262    Jason Huggins <http://www.jrandolph.com/blog/> 
    6363    Michael Josephson <http://www.sdjournal.com/> 
     64    junzhang.jn@gmail.com 
    6465    Russell Keith-Magee <freakboy@iinet.net.au> 
    6566    Garth Kidd <http://www.deadlybloodyserious.com/> 
  • django/branches/magic-removal/django/contrib/syndication/feeds.py

    r1995 r2344  
    3434            return default 
    3535        if callable(attr): 
    36             try: 
     36            # Check func_code.co_argcount rather than try/excepting the 
     37            # function and catching the TypeError, because something inside 
     38            # the function may raise the TypeError. This technique is more 
     39            # accurate. 
     40            if hasattr(attr, 'func_code'): 
     41                argcount = attr.func_code.co_argcount 
     42            else: 
     43                argcount = attr.__call__.func_code.co_argcount 
     44            if argcount == 2: # one argument is 'self' 
    3745                return attr(obj) 
    38             except TypeError
     46            else
    3947                return attr() 
    4048        return attr 
  • django/branches/magic-removal/django/db/models/fields/related.py

    r2289 r2344  
    102102    # managerclass: class that can create and save new objects 
    103103    # rel_model: the model class of the 'related' object 
    104     # join_table: name of the m2m link table  
     104    # join_table: name of the m2m link table 
    105105    # this_col_name: the PK colname in join_table for 'this' object 
    106106    # rel_col_name: the PK colname in join_table for the related object 
     
    126126    cursor.execute("SELECT %s FROM %s WHERE %s = %%s AND %s IN (%s)" % \ 
    127127        (rel_col_name, join_table, this_col_name, 
    128         rel_col_name, ",".join(['%s'] * len(new_ids))),  
     128        rel_col_name, ",".join(['%s'] * len(new_ids))), 
    129129        [this_pk_val] + list(new_ids)) 
    130130    if cursor.rowcount is not None and cursor.rowcount > 0: 
     
    145145    # to do removal from a many-to-many field. 
    146146    # rel_model: the model class of the 'related' object 
    147     # join_table: name of the m2m link table  
     147    # join_table: name of the m2m link table 
    148148    # this_col_name: the PK colname in join_table for 'this' object 
    149149    # rel_col_name: the PK colname in join_table for the related object 
     
    167167    # Utility function used by the ManyRelatedObjectsDescriptors 
    168168    # to clear all from a many-to-many field. 
    169     # join_table: name of the m2m link table  
     169    # join_table: name of the m2m link table 
    170170    # this_col_name: the PK colname in join_table for 'this' object 
    171171    # this_pk_val: the primary key for 'this' object 
     
    312312        except AttributeError: # to._meta doesn't exist, so it must be RECURSIVE_RELATIONSHIP_CONSTANT 
    313313            assert isinstance(to, basestring), "ForeignKey(%r) is invalid. First parameter to ForeignKey must be either a model, a model name, or the string %r" % (to, RECURSIVE_RELATIONSHIP_CONSTANT) 
    314             kwargs['verbose_name'] = kwargs.get('verbose_name', '') 
    315314        else: 
    316315            to_field = to_field or to._meta.pk.name 
    317             kwargs['verbose_name'] = kwargs.get('verbose_name', to._meta.verbose_name
     316        kwargs['verbose_name'] = kwargs.get('verbose_name', ''
    318317 
    319318        if kwargs.has_key('edit_inline_type'):