Beispiel #1
0
    def get_messages(self, context):
        """Return the message string of the last action.
        A list of messages is supported.
        """
        # Text
        if context.message is not None:
            messages = context.message
        elif 'error' in context.uri.query:
            messages = ERROR(context.get_query_value('error', type=Unicode))
        elif 'info' in context.uri.query:
            messages = INFO(context.get_query_value('info', type=Unicode))
        # XXX For backwards compatibility
        elif 'message' in context.uri.query:
            messages = INFO(context.get_query_value('message', type=Unicode))
        else:
            return None

        # Multiple messages:
        if not isinstance(messages, list):
            messages = [messages]

        messages_ns = []
        for message in messages:
            css_class = getattr(message, 'css', 'info')
            messages_ns.append({'message': message, 'class': css_class})

        namespace = {'messages': messages_ns}

        template = context.get_template('/ui/aruni/message.xml')
        return stl(template, namespace)
Beispiel #2
0
    def action(self, resource, context, form):
        email = form['username'].strip()
        password = form['password']

        # Check the user exists
        root = context.root
        user = root.get_user_from_login(email)
        if user is None:
            message = ERROR(u'The user "{username}" does not exist.',
                            username=email)
            goto = context.get_referrer()
            return context.come_back(message, goto)

        # Check the password is right
        if not user.authenticate(password, clear=True):
            message = ERROR(u'The password is wrong.')
            goto = context.get_referrer()
            return context.come_back(message, goto)

        # Check user is enabled
        ac = resource.get_access_control()
        if not user.get_property('is_enabled') and \
            not ac.is_admin(user, resource):
            message = ERROR(u"""Your account isn't validated,
                please contact the webmaster""")
            goto = context.get_referrer()
            return context.come_back(message, goto)

        # Check user has confirm is registration
        if user.get_property('user_must_confirm'):
            message = ERROR(u"""Your account has not been confirmed.""")
            goto = '/users/%s/;confirm_registration' % user.name
            return context.come_back(message, goto)

        # We log authentification
        if resource != context.root:
            shop = get_shop(resource)
            if shop.get_property('log_authentification'):
                logs = shop.get_resource('customers/authentification_logs')
                logs.log_authentification(user.name)
                user.set_property('last_time', datetime.now())

        # Set cookie
        user.set_auth_cookie(context, password)

        # Set context
        context.user = user

        # Come back
        referrer = context.get_referrer()
        if referrer is None:
            goto = get_reference('./')
        else:
            path = get_uri_path(referrer)
            if path.endswith(';login'):
                goto = get_reference('./')
            else:
                goto = referrer

        return context.come_back(INFO(u"Welcome!"), goto)
Beispiel #3
0
    def action(self, resource, context, form):
        # Check register key
        key = resource.get_property('user_state').get_parameter('key')
        if not key:
            context.message = MSG(u'User is not pending')
            return

        if form['key'] != key:
            context.message = messages.MSG_BAD_KEY
            return

        # Check passwords
        password = form['newpass']
        password2 = form['newpass2']
        if password != password2:
            context.message = messages.MSG_PASSWORD_MISMATCH
            return

        # Set user
        resource.set_value('password', password)
        resource.del_property('user_state')
        # Set cookie
        resource._login(password, context)

        # Send email
        to_addr = resource.get_value('email')
        send_email('register-send-confirmation', context, to_addr,
                   user=resource)

        # Ok
        message = INFO(u'Operation successful! Welcome.')
        return context.come_back(message, goto='./')
Beispiel #4
0
    def action_add_users(self, resource, context, form):
        new_users = form['new_users'].strip()
        users = resource.get_resource('/users')
        root = context.root
        added = []
        for lineno, line in enumerate(new_users.splitlines()):
            lastname, email = parseaddr(line)
            try:
                email = email.encode('utf-8')
            except UnicodeEncodeError:
                email = None
            if not email or not EmailField.is_valid(email):
                context.commit = False
                message = ERROR(u"Unrecognized line {lineno}: {line}")
                context.message = message.gettext(lineno=lineno + 1, line=line)
                return
            if type(lastname) is str:
                lastname = unicode(lastname)
            # Is the user already known?
            user = root.get_user_from_login(email)
            if user is None:
                # Register the user
                user = users.set_user(**{'email': email, 'lastname': lastname})
            resource.subscribe_user(user)
            added.append(user.name)

        if not added:
            context.message = ERROR(u"No user added.")
            return

        context.body['new_users'] = u""

        message = INFO(u"{n} user(s) added.")
        context.message = message.gettext(n=len(added))
Beispiel #5
0
 def action_add_to_cart(self, resource, context, form):
     """ Add to cart """
     cart = ProductCart(context)
     # Check if we can add to cart
     if not resource.is_buyable(context):
         msg = MSG(u"This product isn't buyable")
         return context.come_back(msg)
     # Get purchase options
     declination = None
     kw = {}
     for key in resource.get_purchase_options_schema():
         if form[key] is not None:
             kw[key] = form[key]
     if kw:
         declination = resource.get_declination(kw)
         if declination is None:
             context.message = ERROR(u'Declination not exist')
             return
     # Check if product is in stock
     cart_quantity = cart.get_product_quantity_in_cart(resource.name)
     total_quantity =  cart_quantity + form['quantity']
     if not resource.is_in_stock_or_ignore_stock(total_quantity, declination):
         msg = u"Quantity in stock insufficient."
         return context.come_back(MSG(msg))
     # Add to cart
     cart.add_product(resource, form['quantity'], declination)
     # Information message
     context.message = INFO(u'Product added to cart !')
Beispiel #6
0
 def action(self, resource, context, form):
     row = [form[name] for name, title in resource.get_columns()]
     row = resource.handler.add_row(row)
     # Ok
     message = INFO(u'New row added.')
     goto = ';edit_row?index=%s' % row.number
     return context.come_back(message, goto=goto)
Beispiel #7
0
 def action(self, resource, context, form):
     from declination import Declination
     product_model = resource.get_property('product_model')
     if product_model == form['product_model']:
         msg = INFO(u'Product model has not been changed !')
         return context.come_back(msg, goto='./;edit')
     if product_model:
         # Delete schema
         product_model = resource.get_product_model()
         for key in product_model.get_model_schema():
             resource.del_property(key)
         # Delete declinations
         for declination in resource.search_resources(cls=Declination):
             resource.del_resource(declination.name)
     resource.set_property('product_model', form['product_model'])
     msg = INFO(u'Product model changed !')
     return context.come_back(msg, goto='./;edit')
Beispiel #8
0
 def action_add_message(self, resource, context, form):
     shop = get_shop(resource)
     order = shop.get_resource('orders/%s' % form['id'])
     messages = order.get_resource('messages')
     messages.add_new_record({'author': context.user.name,
                              'private': False,
                              'message': form['message']})
     order.notify_new_message(form['message'], context)
     context.message = INFO(u'Your message has been sent')
Beispiel #9
0
    def action_add_language(self, resource, context, form):
        resource = context.root

        ws_languages = resource.get_value('website_languages')
        ws_languages = list(ws_languages)
        ws_languages.append(form['code'])
        resource.set_property('website_languages', ws_languages)
        # Ok
        context.message = INFO(u'Language added.')
Beispiel #10
0
 def action_delete(self, resource, context, form):
     shop = get_shop(resource)
     try:
         resource.parent.del_resource(resource.name)
     except ConsistencyError:
         # TODO improve message
         context.message = ERROR(u"You can't delete this product")
         return
     return context.come_back(INFO(u'Product deleted !'), goto='../')
Beispiel #11
0
 def GET(self, resource, context):
     reference = context.query['reference']
     if reference:
         order = resource.parent.get_resource(str(reference), soft=True)
         if order:
             msg = INFO(u'Reference found !')
             return context.come_back(msg, goto=context.get_link(order))
         else:
             context.message = ERROR(u'Unknow reference "%s"' % reference)
     return STLForm.GET(self, resource, context)
Beispiel #12
0
 def action_add_message(self, resource, context, form):
     messages = resource.get_resource('messages')
     messages.add_new_record({
         'author': context.user.name,
         'private': form['private'],
         'message': form['message'],
         'seen': True
     })
     if form['private'] is False:
         resource.notify_new_message(form['message'], context)
     context.message = INFO(u'Your message has been sent')
Beispiel #13
0
    def action_remove(self, resource, context, form):
        ids = form['ids']
        if len(ids) == 0:
            context.message = ERROR(u'Nothing to remove.')
            return

        # New timetables
        timetables = resource.get_value('timetables')
        timetables = [
            timetable for index, timetable in enumerate(timetables)
            if index not in ids
        ]
        resource.set_property('timetables', timetables)
        # Ok
        context.message = INFO(u'Timetable(s) removed successfully.')
Beispiel #14
0
    def action_remove(self, resource, context, form):
        from countries import CountriesEnumerate
        ids = form['ids']
        for id in ids:
            datatype = CountriesEnumerate(zone=id)
            options = datatype.get_options()
            if len(options) != 0:
                record = resource.handler.get_record(id)
                zone = resource.handler.get_record_value(record, 'title')
                context.message = ERROR(self.del_msg % (zone, len(options)))
                return
            resource.handler.del_record(id)
        # Reindex the resource
        context.server.change_resource(resource)

        context.message = INFO(u'Zone(s) deleted')
Beispiel #15
0
    def action_remove_languages(self, resource, context, form):
        resource = context.root

        # Check the default language is not to be removed
        codes = form['codes']
        languages = resource.get_value('website_languages')
        default = languages[0]
        if default in codes:
            message = ERROR(u'You can not remove the default language.')
            context.message = message
            return

        # Remove the languages
        languages = [x for x in languages if x not in codes]
        resource.set_property('website_languages', languages)
        # Ok
        context.message = INFO(u'Languages removed.')
Beispiel #16
0
    def action(self, resource, context, form):
        # Get form values
        contact = form['to']
        reply_to = form['from'].strip()
        subject = form['subject'].strip()
        body = form['message_body'].strip()

        # Find out the "to" address
        contact = resource.get_resource('/users/%s' % contact)
        contact_title = contact.get_title()
        contact = contact.get_value('email')
        if contact_title != contact:
            contact = (contact_title, contact)
        # Send the email
        root = resource.get_root()
        root.send_email(contact, subject, reply_to=reply_to, text=body)
        # Ok
        context.message = INFO(u'Message sent.')
Beispiel #17
0
    def action(self, resource, context, form):
        file = form['file']
        filename, mimetype, body = file

        # Check wether the handler is able to deal with the uploaded file
        if mimetype != 'text/calendar':
            message = messages.MSG_UNEXPECTED_MIMETYPE(mimetype=mimetype)
            context.message = message
            return

        # Replace
        try:
            resource.load_state_from_ical_file(StringIO(body))
        except BaseException:
            message = ERROR(u'Failed to load the file, may contain errors.')
            context.message = message
        else:
            context.database.change_resource(resource)
            context.message = INFO(u'Version uploaded')
Beispiel #18
0
 def action_remove(self, resource, context, form):
     """If we delete an item in an Enumerate,
        we have to delete the property of products that
        value correspond to the enumerate value we delete.
     """
     ids = form['ids']
     handler = resource.handler
     for id in ids:
         # Get value of record
         record = handler.get_record(id)
         # References ?
         quantity = self.get_quantity(resource, context, record)
         if quantity > 0:
             context.commit = False
             context.message = ERROR(u"You can't delete this value")
             return
         # We delete record
         resource.handler.del_record(id)
     # Reindex the resource
     context.server.change_resource(resource)
     context.message = INFO(u'Record deleted.')
Beispiel #19
0
 def action(self, resource, context, form):
     root = context.root
     references_number = form['references_number']
     for i in range(1, references_number + 1):
         reference = form['reference_%s' % i]
         if not reference:
             context.message = ERROR(
                 u'[Error] Line number %s has no reference' % i)
             context.commit = False
             return
         new_stock = form['new_stock_%s' % i]
         search = root.search(reference=reference)
         results = search.get_documents()
         if not results:
             context.message = ERROR(u'[Error] Unknow reference %s' %
                                     reference)
             context.commit = False
             return
         # XXX
         #if len(results) > 1:
         #    context.message = ERROR(u'[Error] Reference %s is used %s times.' %
         #                          (reference, len(results)))
         #    context.commit = False
         #    return
         product = root.get_resource(results[0].abspath)
         if new_stock:
             product.set_property('stock-quantity', new_stock)
         nb_declinations = form['nb_declinations_%s' % i]
         if nb_declinations == 0:
             continue
         #declinations = list(product.search_resources(cls=Declination))
         for j in range(1, nb_declinations + 1):
             suffix = '_%s_%s' % (i, j)
             name_declination = form['name' + suffix]
             stock_declination = form['new_stock' + suffix]
             if stock_declination:
                 declination = product.get_resource(name_declination)
                 declination.set_property('stock-quantity',
                                          stock_declination)
     context.message = INFO(u'Stock quantity has been updated')
Beispiel #20
0
    def get_goto(self, user):
        context = self.context

        # Check if user account is completed
        for name, field in user.get_fields():
            if field.required and user.get_value(name) is None:
                msg = MSG(u'You must complete your account informations')
                goto = '/users/%s/;edit_account' % user.name
                return context.come_back(msg, goto)

        # Come back
        referrer = context.get_referrer()
        if referrer is None:
            goto = get_reference('./')
        else:
            path = get_uri_path(referrer)
            if path.endswith(';login') or path.endswith(';register'):
                goto = get_reference('./')
            else:
                goto = referrer

        return context.come_back(INFO(u"Welcome!"), goto)
Beispiel #21
0
 def action_remove(self, resource, context, form):
     """When we delete an attribute we have to delete it in products"""
     ids = form['ids']
     properties_name = []
     table_h = resource.handler
     for id in ids:
         record = table_h.get_record(id)
         property_name = table_h.get_record_value(record, 'name')
         properties_name.append(property_name)
         table_h.del_record(id)
     # Search products
     root = context.root
     product_model = resource.parent.get_abspath()
     # XXX Search only on website
     query = PhraseQuery('product_model', str(product_model))
     results = root.search(query)
     for doc in results.get_documents():
         product = root.get_resource(doc.abspath)
         for property_name in properties_name:
             product.del_property(property_name)
     # Reindex the resource
     context.server.change_resource(resource)
     context.message = INFO(u'Record deleted.')
Beispiel #22
0
    def action_confirm_key(self, resource, context, form):
        # Get the email address
        form['username'] = form['username'].strip()
        email = form['username']

        # Get the user with the given login name
        user = self._get_user(resource, context, email)
        if user is None:
            message = ERROR(u'There is no user identified as "{username}"',
                      username=email)
            context.message = message
            return

        # Check register key
        must_confirm = user.get_property('user_must_confirm')
        if not must_confirm:
            # Already confirmed
            message = ERROR(u'Your account has already been confirmed')
            context.message = message
            return
        elif form['key'] != must_confirm:
            message = ERROR(u'Your activation key is wrong')
            context.message = message
            return

        user.del_property('user_must_confirm')
        # We log-in user
        username = str(user.name)
        crypted = user.get_property('password')
        cookie = Password.encode('%s:%s' % (username, crypted))
        context.set_cookie('__ac', cookie, path='/')
        context.user = user

        # Ok
        message = INFO(u'Operation successful! Welcome.')
        return context.come_back(message, goto='/users/%s' % user.name)
Beispiel #23
0
    def action_add_and_return(self, resource, context, form):
        child = self.make_new_resource(resource, context, form)
        if child is None:
            return

        context.message = INFO(u'User added.')
Beispiel #24
0
class Order_Manage(Payments_EditablePayment, STLForm):

    access = 'is_admin'
    title = MSG(u'Manage shipping')

    template = '/ui/backoffice/orders/order_manage.xml'

    def get_query_schema(self):
        return {
            'sort_by': String(default='title'),
            'reverse': Boolean(default=False),
            'reference': Integer
        }

    def GET(self, resource, context):
        reference = context.query['reference']
        if reference:
            order = resource.parent.get_resource(str(reference), soft=True)
            if order:
                msg = INFO(u'Reference found !')
                return context.come_back(msg, goto=context.get_link(order))
            else:
                context.message = ERROR(u'Unknow reference "%s"' % reference)
        return STLForm.GET(self, resource, context)

    def get_namespace(self, resource, context):
        # Get some resources
        shop = get_shop(resource)
        addresses = shop.get_resource('addresses').handler
        # Build namespace
        namespace = resource.get_namespace(context)
        for key in ['is_payed', 'is_sent']:
            namespace[key] = resource.get_property(key)
        # States
        namespace['is_canceled'] = resource.get_statename() == 'cancel'
        namespace['state'] = {
            'title': states[resource.workflow_state],
            'color': states_color[resource.workflow_state]
        }
        namespace['transitions'] = SelectWidget('transition').to_html(
            Order_Transitions, None)
        # Bill
        has_bill = resource.get_resource('bill', soft=True) is not None
        namespace['has_bill'] = has_bill
        has_order = resource.get_resource('order', soft=True) is not None
        namespace['has_order'] = has_order
        # Order
        creation_datetime = resource.get_property('creation_datetime')
        namespace['order'] = {
            'id': resource.name,
            'date': format_datetime(creation_datetime, context.accept_language)
        }
        for key in ['shipping_price', 'total_price', 'total_weight']:
            namespace['order'][key] = resource.get_property(key)
        namespace['order']['shipping_way'] = ShippingWaysEnumerate.get_value(
            resource.get_property('shipping'))
        namespace['order']['payment_way'] = PaymentWaysEnumerate.get_value(
            resource.get_property('payment_mode'))
        # Delivery and shipping addresses
        get_address = addresses.get_record_namespace
        delivery_address = resource.get_property('delivery_address')
        bill_address = resource.get_property('bill_address')
        namespace['delivery_address'] = get_address(delivery_address)
        namespace['bill_address'] = get_address(bill_address)
        # Price
        for key in ['shipping_price', 'total_price']:
            price = resource.get_property(key)
            namespace[key] = format_price(price)
        # Messages
        messages = resource.get_resource('messages')
        namespace['messages'] = messages.get_namespace_messages(context)
        # Payments (We show last payment)
        namespace['payments'] = []
        payments = shop.get_resource('payments')
        for payment_way, payment_record in payments.get_payments_records(
                context, resource.name):
            payment_table = payment_way.get_resource('payments').handler
            # Get specific view (useless now ?)
            view = payment_way.order_edit_view
            view = view(payment_way=payment_way,
                        payment_table=payment_table,
                        record=payment_record,
                        id_payment=payment_record.id)
            view = view.GET(resource, context)
            # Details
            details = []
            for name, datatype in payment_table.record_properties.items():
                if name in ('resource_validator', 'state', 'ref', 'user'):
                    continue
                value = payment_table.get_record_value(payment_record, name)
                if issubclass(datatype, Enumerate):
                    value = datatype.get_value(value)
                details.append({
                    'title': getattr(datatype, 'title', name),
                    'value': value
                })
            # Is payed ?
            is_payed = payment_table.get_record_value(payment_record, 'state')
            # BUild namespace
            namespace['payments'].append({
                'is_payed':
                is_payed,
                'title':
                payment_way.get_title(),
                'details':
                details,
                'state':
                payment_table.get_record_value(payment_record, 'state'),
                'view':
                view
            })
        namespace['last_payment'] = namespace['payments'][0]
        namespace['payment_ways'] = SelectWidget(
            'payment_way', has_empty_option=False).to_html(
                PaymentWaysEnumerate, resource.get_property('payment_way'))
        # Shippings
        is_sent = resource.get_property('is_sent')
        shippings = shop.get_resource('shippings')
        shipping_way = resource.get_property('shipping')
        if shipping_way == 'default':
            shippings_records = None
        else:
            shipping_way_resource = shop.get_resource('shippings/%s/' %
                                                      shipping_way)
            shippings_records = shippings.get_shippings_records(
                context, resource.name)
        if is_sent:
            view = None
            if shippings_records:
                # We show last delivery
                last_delivery = shippings_records[0]
                edit_record_view = shipping_way_resource.order_edit_view
                view = edit_record_view.GET(resource, shipping_way_resource,
                                            last_delivery, context)
        elif shippings_records is None and shipping_way == 'default':
            view = None
        else:
            # We have to add delivery
            add_record_view = shipping_way_resource.order_add_view
            if add_record_view:
                view = add_record_view.GET(shipping_way_resource, context)
            else:
                view = None
        namespace['shipping_ways'] = SelectWidget(
            'shipping_way',
            has_empty_option=False).to_html(ShippingWaysEnumerate,
                                            shipping_way)
        namespace['shipping'] = {'is_sent': is_sent, 'view': view}
        return namespace

    action_change_order_state_schema = {
        'transition': Order_Transitions,
        'comments': Unicode
    }

    def action_change_order_state(self, resource, context, form):
        try:
            resource.make_transition(form['transition'], form['comments'])
        except WorkflowError, excp:
            log_error(excp.message, domain='ikaaro')
            context.message = ERROR(unicode(excp.message, 'utf-8'))
            return
        # Ok
        context.message = INFO(u'Transition done.')
Beispiel #25
0
 def action_remove(self, resource, context, form):
     ids = form['ids']
     resource.handler.del_rows(ids)
     # Ok
     context.message = INFO(u'Row deleted.')
Beispiel #26
0
from itools.datatypes import Email, Enumerate, MultiLinesTokens
from itools.datatypes import String
from itools.gettext import MSG
from itools.web import get_context, INFO, ERROR

# Import from ikaaro
from autoform import AutoForm, TextWidget, ReadOnlyWidget, MultilineWidget
from autoform import HiddenWidget
from buttons import Button, BrowseButton
from fields import Select_Field
from messages import MSG_BAD_KEY
from users_views import BrowseUsers
from utils import generate_password
from views import CompositeView

MSG_CONFIRMATION_SENT = INFO(u'A message has been sent to confirm your '
                             u'identity.')
MSG_USER_SUBSCRIBED = INFO(u'You are now subscribed.')
MSG_USER_ALREADY_SUBSCRIBED = ERROR(u'You were already subscribed.')
MSG_USER_UNSUBSCRIBED = INFO(u'You are now unsubscribed.')
MSG_USER_ALREADY_UNSUBSCRIBED = ERROR(u'You were already unsubscribed.')
MSG_ALREADY = INFO(u'The following users are already subscribed: {users}.',
                   format='replace_html')
MSG_SUBSCRIBED = INFO(u'The following users were subscribed: {users}.',
                      format='replace_html')
MSG_UNSUBSCRIBED = INFO(u'The following users were unsubscribed: {users}.',
                        format='replace_html')
MSG_INVALID = ERROR(u'The following addresses are invalid: {users}.',
                    format='replace_html')
MSG_INVITED = INFO(u'The following users have been invited: {users}.',
                   format='replace_html')
MSG_UNALLOWED = ERROR(
Beispiel #27
0
 def action_change_message_state(self, resource, context, form):
     handler = resource.get_resource('messages').handler
     record = handler.get_record(form['id_message'])
     seen = handler.get_record_value(record, 'seen')
     handler.update_record(form['id_message'], **{'seen': not seen})
     context.message = INFO(u'Changes saves')
Beispiel #28
0
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Import from itools
from itools.gettext import MSG
from itools.web import INFO, ERROR

MSG_BAD_KEY = ERROR(u"Your confirmation key is invalid.")

MSG_BAD_NAME = ERROR(
    u'The document name contains illegal characters, choose another one.')

MSG_CAPTION = ERROR(u'Caption')

MSG_CHANGES_SAVED = INFO(u'The changes have been saved.')

MSG_CHANGES_SAVED2 = INFO(u'The changes have been saved ({time}).')

MSG_DELETE_RESOURCE = MSG(u'Are you sure you want to delete this resource?')

MSG_EDIT_CONFLICT = ERROR(
    u'Someone already saved this document, click "Save" again to force.')

MSG_EDIT_CONFLICT2 = ERROR(
    u'User {user} already saved this document, click "Save" again to force.')

MSG_EMPTY_FILENAME = ERROR(u'The file must be entered.')

MSG_EXISTANT_FILENAME = ERROR(u'A given name already exists.')
Beispiel #29
0
    def GET(self, resource, context):
        context.logout()

        message = INFO(u'You Are Now Logged out.')
        return context.come_back(message, goto='./')
Beispiel #30
0
from itools.core import freeze
from itools.datatypes import Unicode
from itools.gettext import MSG
from itools.web import INFO, ERROR, STLView

# Import from ikaaro
from ikaaro.autoadd import AutoAdd
from ikaaro.autoedit import AutoEdit
from ikaaro.fields import Char_Field
from ikaaro.views import AutoTable

# Import from here
from buttons import AddUsersButton, Remove_BrowseButton
from datatypes import EmailField

INFO_NEW_APPLICATION = INFO(u'Your application is created !')
INFO_NEW_APPLICATION_WITH_ERRORS = INFO(u'Your application is created but '
                                        u'theres errors')
MSG_APPLICATION_TITLE = MSG(u'''<span class="application-title">Title of your
application:</span> {title}''',
                            format='replace_html')


class Applications_View(AutoTable):

    title = MSG(u'Applications')
    base_classes = ('application', )
    table_fields = ['checkbox', 'title', 'subscription', 'nb_answers', 'ctime']
    table_actions = [Remove_BrowseButton]

    # Fields