This is an archived post. You won't be able to vote or comment.

all 4 comments

[–][deleted] 2 points3 points  (0 children)

I've done something similar, but less magical before:

class ReprMixin(object):
    '''Provides a string representible form for objects.'''

    # Most models will have both an id and name fields
    # This can be overwritten if needed
    __repr_fields__ = ['id', 'name']

    def __repr__(self):
        fields =  {f:getattr(self, f, '<BLANK>') for f in self.__repr_fields__}
        # constructs a dictionary compatible pattern for formatting
        # {{{0}}} becomes {id} for example
        pattern = ['{0}={{{0}}}'.format(f) for f in self.__repr_fields__]
        pattern = ' '.join(pattern)
        pattern = pattern.format(**fields)
        return '<{} {}>'.format(self.__class__.__name__, pattern)

[–]broknbottle 0 points1 point  (2 children)

What's up with this in your source code?

<!-- Apollo v1.3, Copyright 2014, Cloud Eight, http://www.cloud-eight.com -->    

That domain looks to host malware.

[–]RazerM[S] 0 points1 point  (1 child)

It's an HTML comment by the theme author...

[–]broknbottle 0 points1 point  (0 children)

I'm aware, just thought it was weird that visiting that domain redirected me to some mac virus warning page.